Created
January 7, 2014 17:40
-
-
Save tanakh/8303232 to your computer and use it in GitHub Desktop.
Haskellでループみたいなん
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 | |
import Control.Monad.Trans | |
import Control.Monad.Trans.Loop | |
main :: IO () | |
main = do | |
putStrLn $ "Can you guess the number I have?" | |
repeatLoopT $ do | |
a <- liftIO $ readLn | |
liftIO $ putStrLn $ "You said: " ++ show a | |
when (a == 42) $ do | |
liftIO $ putStrLn "That's right!" | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment