Created
December 12, 2016 11:00
-
-
Save adamw/65eb05116de6628719f0c438c8fe6ee7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
implicit def readerDistributive[I]: Distributive[({type R[X]=Reader[I, X]})#R] = new Distributive[({type R[X]=Reader[I, X]})#R] { | |
override def distributeImpl[G[_], A, B](fa: G[A])(f: (A) => Reader[I, B])(implicit gf: Functor[G]): Reader[I, G[B]] = | |
Reader { i => | |
fa.map(a => f(a)(i)) | |
} | |
override def map[A, B](fa: Reader[I, A])(f: (A) => B): Reader[I, B] = fa.map(f) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment