Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created April 15, 2015 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shigemk2/6d7e83eec0e3ec365a38 to your computer and use it in GitHub Desktop.
Save shigemk2/6d7e83eec0e3ec365a38 to your computer and use it in GitHub Desktop.
-- Haskellのreturnは他のプログラミング言語とは違う意味を持つ
main = do
return ()
return "HAHAHA"
line <- getLine
return "BLAH BLAH BLAH"
return 4
putStrLn line
main = do
-- こういう書き方はダメ
-- a <- "hell"
-- b <- "yeah!"
-- 箱にするのがreturn
-- 箱の中身を取り出して束縛するのが<-
a <- return "hell"
b <- return "yeah!"
putStrLn $ a ++ " " ++ b
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