Last active
January 20, 2017 21:01
-
-
Save mstksg/dac60de20e44879110a5b1c076985178 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
foo :: StateT s m Int | |
bar :: Int -> StateT s m Bool | |
-- using State appropriately | |
baz :: StateT s m Bool | |
baz = do | |
x <- foo | |
bar x | |
-- ignoring the State abstraction | |
baz :: StateT s m Bool | |
baz = StateT $ \s -> do | |
(x, s') <- runStateT foo s | |
runStateT (baz x) s' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment