|
Scala example source code file (UnwriterTTest.scala)
The UnwriterTTest.scala Scala example source code
package scalaz
import scalaz.scalacheck.ScalazProperties._
import scalaz.scalacheck.ScalazArbitrary._
import scalaz.scalacheck.ScalaCheckBinding._
import std.AllInstances._
import org.scalacheck.Arbitrary
object UnwriterTTest extends SpecLite {
type UnwriterTOpt[W, A] = UnwriterT[Option, W, A]
type UnwriterTOptInt[A] = UnwriterTOpt[Int, A]
checkAll(equal.laws[UnwriterTOptInt[Int]])
checkAll(bind.laws[UnwriterTOptInt])
checkAll(traverse.laws[UnwriterTOptInt])
checkAll(bitraverse.laws[UnwriterTOpt])
implicit def UnwriterArb[F[_], W, A](implicit W: Arbitrary[W], A: Arbitrary[A]): Arbitrary[Unwriter[W, A]] =
Applicative[Arbitrary].apply2(W, A)(Unwriter(_, _))
checkAll(comonad.laws[Unwriter[Int, ?]])
object instances {
def equal[F[_], W, A](implicit E: Equal[F[(W, A)]]) = Equal[UnwriterT[F, W, A]]
def functor[F[_]: Functor, W] = Functor[UnwriterT[F, W, ?]]
def apply[F[_]: Apply, W] = Apply[UnwriterT[F, W, ?]]
def bind[F[_]: Bind, W] = Bind[UnwriterT[F, W, ?]]
def bifunctor[F[_]: Functor] = Bifunctor[UnwriterT[F, ?, ?]]
def bitraverse[F[_]: Traverse] = Bitraverse[UnwriterT[F, ?, ?]]
def foldable[F[_]: Foldable, W] = Foldable[UnwriterT[F, W, ?]]
def traverse[F[_]: Traverse, W] = Traverse[UnwriterT[F, W, ?]]
object Unwriter {
def comonad[W] = Comonad[Unwriter[W, ?]]
}
}
}
Other Scala examples (source code examples)Here is a short list of links related to this Scala UnwriterTTest.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.