-
Notifications
You must be signed in to change notification settings - Fork 8
Algebra
adampingel edited this page Jan 28, 2013
·
14 revisions
This package is part of the Axle domain specific language.
The axle.algebra
package contains typeclasses for algebraic structures including Monoid, Functor, and Monad.
3 |+| 4 //> res3: Int = 7
Monoid.checkAxiom1(3) //> res7: Boolean = true
Monoid.checkAxiom2(3) //> res8: Boolean = true
Monoid.checkAxiom3(2, 4, 5) //> res9: Boolean = true
Functor.checkAxiom1(List(1, 2, 3)) //> res5: Boolean = true
Functor.checkAxiom2(List(1, 2, 3), (x: Int) => x + 3, (y: Int) => y * 5)
//> res6: Boolean = true
Monad.checkAxiom1(3, (x: Int) => List(x + 1)) //> res11: Boolean = true
Monad.checkAxiom2(List(1, 2, 3)) //> res12: Boolean = true
Monad.checkAxiom3(
List(1, 2, 3),
(x: Int) => List(x + 4),
(x: Int) => List(x + 10)) //> res13: Boolean = true