You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
686 B

package green.thisfieldwas.embracingnondeterminism.stdlib
import green.thisfieldwas.embracingnondeterminism.data.{Monoid, MonoidLaws, SemigroupLaws}
import green.thisfieldwas.embracingnondeterminism.util._
/** Proves that Scala's Int conforms to Monoids and Semigroups.
*/
class IntegerSpec extends Laws with SemigroupLaws with MonoidLaws {
implicit val intMonoid: Monoid[Int] = new Monoid[Int] {
/** Int's form Monoids with an identity value of 0.
*/
override def empty: Int = 0
/** Int's form Semigroups under addition.
*/
override def combine(left: Int, right: Int): Int = left + right
}
checkSemigroupLaws[Int]()
checkMonoidLaws[Int]()
}