Created
November 25, 2017 08:41
-
-
Save mizukmb/e4bfebaddb40c3805c73d0dc888251ae 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
import Data.Char | |
-- main = putStrLn "Hello, World" | |
-- main = do | |
-- putStrLn "Hello, what's your name?" | |
-- name <- getLine | |
-- putStrLn ("Hey " ++ name ++ ", you rock!") | |
main = do | |
putStrLn "What's your first name?" | |
firstName <- getLine -- <- は IO アクションを束縛する際に使う | |
putStrLn "What's your last name?" | |
lastName <- getLine | |
-- let は純粋な式を名前に束縛する際に使う | |
let bigFirstName = map toUpper firstName | |
bigLastName = map toUpper lastName | |
putStrLn $ "hey " ++ bigFirstName ++ " " | |
++ bigLastName ++ " " | |
++ ", how are you?" |
$ stack ghc helloworld.hsc
$ ./helloworld
What's your first name?
foo
What's your last name?
bar
hey FOO BAR , how are you?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
すごいHaskellたのしく学ぼう! 『第8章 入出力』より