Skip to content

Instantly share code, notes, and snippets.

@stew
Last active August 29, 2015 14:01
Show Gist options
  • Save stew/b9f451bcf541cda02583 to your computer and use it in GitHub Desktop.
Save stew/b9f451bcf541cda02583 to your computer and use it in GitHub Desktop.
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