Last active
August 29, 2015 14:03
-
-
Save mstksg/aa70c9182c387e6f67b1 to your computer and use it in GitHub Desktop.
Home-made IO+State Monad
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
andThen :: (s -> IO (a, s)) -> (s -> IO (b, s)) -> (s -> IO (b, s)) | |
andThenWith :: (s -> IO (a, s)) -> (a -> (s -> IO (b, s))) -> (s -> IO (b, s)) | |
-- type synonym: | |
-- | |
-- > type MIOS s a = s -> IO (s, a) | |
-- | |
-- lets us write the above as: | |
-- | |
-- andThen :: MIOS s a -> MIOS s b -> MIOS s b | |
-- andThenWith :: MIOS s a -> (a -> MIOS s b) -> MIOS s b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment