Created
November 11, 2014 10:58
-
-
Save bananu7/81c40f2993c670a2a78f 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
--hoistState :: Monad m => S.State s a -> S.StateT s m a | |
--hoistState = S.StateT . (return .) . S.runState | |
hoistState :: (Monad m, S.MonadState s m) => S.State s a -> m a | |
hoistState op = do | |
x <- S.get | |
let (r, x') = S.runState op x | |
S.put x' | |
return r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment