Created
April 15, 2015 12:23
-
-
Save shigemk2/6d7e83eec0e3ec365a38 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
-- Haskellのreturnは他のプログラミング言語とは違う意味を持つ | |
main = do | |
return () | |
return "HAHAHA" | |
line <- getLine | |
return "BLAH BLAH BLAH" | |
return 4 | |
putStrLn line |
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
main = do | |
-- こういう書き方はダメ | |
-- a <- "hell" | |
-- b <- "yeah!" | |
-- 箱にするのがreturn | |
-- 箱の中身を取り出して束縛するのが<- | |
a <- return "hell" | |
b <- return "yeah!" | |
putStrLn $ a ++ " " ++ b |
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
main = do | |
let a = "hell" | |
b = "yeah" | |
putStrLn $ a ++ " " ++ b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment