Last active
August 29, 2015 14:01
-
-
Save stew/b9f451bcf541cda02583 to your computer and use it in GitHub Desktop.
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._, Scalaz._ | |
object Main { | |
trait A | |
trait B | |
trait AB extends A with B | |
type ReadA[T] = Reader[A, T] | |
type ReadB[T] = Reader[B, T] | |
type ReadAB[T] = Reader[AB, T] | |
val readsA: ReadA[Unit] = ().pure[ReadA] | |
val readsB: ReadB[Unit] = ().pure[ReadB] | |
val readsBothOptionT: OptionT[ReadAB, Unit] = { | |
for { | |
_ <- readsA.local[AB](x=>x).liftM[OptionT] | |
_ <- readsB.local[AB](x=>x).liftM[OptionT] | |
} yield () | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment