Created
October 2, 2014 23:19
-
-
Save gigiigig/9d5c17ba848414e4804f to your computer and use it in GitHub Desktop.
2 level monad transformer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scalaz._ | |
import Scalaz._ | |
object console extends App { | |
type ListTOption[A] = ListT[Option, A] | |
val v1: Option[List[\/[String, Int]]] = 1.right[String].point[List].point[Option] | |
val v2: Option[List[\/[String, Int]]] = 2.right[String].point[List].point[Option] | |
val t1 = EitherT[ListTOption, String, Int](ListT(v1)) | |
val t2 = EitherT[ListTOption, String, Int](ListT(v2)) | |
val rt = for { | |
v1 <- t1 | |
v2 <- t2 | |
} yield v1 + v2 | |
val res = rt.run.run | |
println(s"res: ${res}") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment