|
Scala example source code file (CodensityTest.scala)
The CodensityTest.scala Scala example source codepackage scalaz import org.scalacheck.Arbitrary import scalaz.scalacheck.ScalazProperties._ import scalaz.scalacheck.ScalaCheckBinding._ import std.list._ import std.anyVal._ import std.option._ object CodensityTest extends SpecLite { implicit def arbCodensity[F[_], A](implicit A: Arbitrary[F[A]], M: Monad[F]) : Arbitrary[Codensity[F, A]] = Functor[Arbitrary].map(A)(Codensity.rep(_)) implicit def eqlCodensity[F[_], A](implicit A: Equal[F[A]], M: Applicative[F]) : Equal[Codensity[F, A]] = Equal.equalBy(_.improve) checkAll("List", monadPlus.laws[Codensity[List, ?]]) checkAll("Option", monadPlus.laws[Codensity[Option, ?]]) object instances { def functor[F[_]: MonadPlus] = Functor[Codensity[F, ?]] def apply[F[_]: MonadPlus] = Apply[Codensity[F, ?]] def applicative[F[_]: MonadPlus] = Applicative[Codensity[F, ?]] def plus[F[_]: MonadPlus] = Plus[Codensity[F, ?]] def monad[F[_]: MonadPlus] = Monad[Codensity[F, ?]] def monade[F[_]] = Monad[Codensity[F, ?]] } } Other Scala examples (source code examples)Here is a short list of links related to this Scala CodensityTest.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.