Created
February 15, 2012 21:48
-
-
Save globulon/1839211 to your computer and use it in GitHub Desktop.
State Monad Kestrel Combinator
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 stateToComprehension[T, S](state: State[T,S]) = new { | |
| implicit val functor = stateFunctor[S]() | |
| val monad = stateMonad[S]() | |
| def map[U](f: T => U) = functor.map(state)(f) | |
| def flatMap[U](f: T => State[U, S]) = monad.flatMap(state)(f) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment