A library for pragmatic application of Category Theory and Mordern Algebra
Steps:
- Clone the sbt project
- Change to home directory of project
- Enter sbt compile to comile it.
- Enter sbt test to test
Create a simple algebratic structure by providing its type as most of algebraic instances are available as implicit values. To make implicit values visible import instaces object of the algebraic strucure.
-
import scat._
-
import MonadInstances._
-
val l = Monad[List]
-
println(l.flatMap(List(1,2,3))(x=> List(x,x)))
-
>>List(1, 1, 2, 2, 3, 3)
You can define new instances of an algebraic structure inside instance object of that algebraic structure inside instances/Instaces.scala file. e.g you can add new Monad instaces in instances/MonadInstances .please make those instances as implicit value.
you can add new algebraic structure as type class in TypeClasses folder and its laws in Law folder and testcases in spec/ folder.