Last active
August 29, 2015 14:14
-
-
Save keizo042/8e63910e55fcfd878c2c 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
import Control.Monad.Writer | |
sayHello :: Writer (Sum Int, Sum Int) String | |
sayHello = do | |
tell (0,1) | |
return "hello" | |
sayGoodbye :: Writer (Sum Int, Sum Int) String | |
sayGoodbye = do | |
tell (1,0) | |
return "goodbye" | |
tweeting = do | |
sayHello | |
sayHello | |
sayHello | |
sayHello | |
sayGoodbye | |
sayGoodbye | |
main :: IO () | |
main = do | |
print $ runWriter tweeting | |
-- putStrLn $ show $ hello . snd t | |
-- putStrLn $ show $ goodbye . snd t | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment