|
Scala example source code file (MaybeTTest.scala)
The MaybeTTest.scala Scala example source codepackage scalaz import scalaz.scalacheck.ScalazProperties._ import scalaz.scalacheck.ScalazArbitrary._ import std.AllInstances._ object MaybeTTest extends SpecLite { type MaybeTList[A] = MaybeT[List, A] type IntOr[A] = Int \/ A type MaybeTEither[A] = MaybeT[IntOr, A] checkAll(equal.laws[MaybeTList[Int]]) checkAll(bindRec.laws[MaybeTList]) checkAll(monadPlus.laws[MaybeTList]) checkAll(traverse.laws[MaybeTList]) checkAll(monadError.laws[MaybeTEither, Int]) object instances { def functor[F[_] : Functor] = Functor[MaybeT[F, ?]] def monad[F[_] : Monad] = MonadPlus[MaybeT[F, ?]] def bindRec[F[_] : Monad : BindRec] = BindRec[MaybeT[F, ?]] def monadError[F[_], E](implicit F: MonadError[F, E]) = MonadError[MaybeT[F, ?], E] def foldable[F[_] : Foldable] = Foldable[MaybeT[F, ?]] def traverse[F[_] : Traverse] = Traverse[MaybeT[F, ?]] // checking absence of ambiguity def functor[F[_] : Monad] = Functor[MaybeT[F, ?]] def functor[F[_] : Monad : Traverse] = Functor[MaybeT[F, ?]] def functor[F[_], E](implicit F1: MonadError[F, E], F2: Traverse[F]) = Functor[MaybeT[F, ?]] def apply[F[_] : Monad] = Apply[MaybeT[F, ?]] def foldable[F[_] : Traverse] = Foldable[MaybeT[F, ?]] def monadEither[E] = Monad[MaybeT[E \/ ?, ?]] } } Other Scala examples (source code examples)Here is a short list of links related to this Scala MaybeTTest.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.