-
-
Save vlad-shatskyi/b40fbb2b6bc574a1b459 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
module Main where | |
import System.Environment | |
import System.IO (hFlush, stdout) | |
ask :: (Show a, Read b) => a -> IO b | |
ask question = do | |
putStr $ show question | |
hFlush stdout | |
answer <- getLine | |
read answer | |
main :: IO () | |
main = do | |
name <- ask "What's your name, stranger? " | |
print $ "Welcome home, " ++ name |
Author
vlad-shatskyi
commented
Feb 27, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment