simple AppFunction
simple AppFunction
scala> import sclib.patterns._ scala> import sclib.ops.either._ scala> val action = for { | a <- AppF{i: Int => i.right[String]} | b <- AppF{i: Int => if(i < 5) (i * 10).right else "BOOM".left} | c <- AppF.lift(33.right[String]) | } yield (a, b, c) action: sclib.z.EitherT[[B]sclib.z.Reader[Int,B],String,(Int, Int, Int)] = EitherT(Reader(<function1>)) scala> action.runEitherT.runReader(2) res0: Either[String,(Int, Int, Int)] = Right((2,20,33)) scala> action.runEitherT.runReader(8) res1: Either[String,(Int, Int, Int)] = Left(BOOM)
pattern's
check the member documentation for examples