「haskell メモ」の編集履歴(バックアップ)一覧はこちら
haskell メモ - (2007/01/17 (水) 21:57:18) の最新版との変更点
追加された行は緑色になります。
削除された行は赤色になります。
#contents
*hello
module Main where
main = putStr "hello"
実行結果:
hello
*do
module Main where
main = do
putStr "hello\n"
putStr "hello\n"
putStr "hello\n"
実行結果:
hello
hello
hello
*show
module Main where
main = putStr (show 111)
実行結果:
111
あるいは:
module Main where
main = putStr $ show 111
実行結果:
222
*関数
module Main where
addStar s = "*" ++ s ++ "*"
main = putStr $ addStar "aaa"
実行結果:
aaa
#contents
*hello
module Main where
main = putStr "hello"
実行結果:
hello
*do
module Main where
main = do
putStr "hello\n"
putStr "hello\n"
putStr "hello\n"
実行結果:
hello
hello
hello
あるいは:
module Main where
main = do
putStrLn "hello"
putStrLn "hello"
putStrLn "hello"
実行結果:
hello
hello
hello
*show
module Main where
main = putStr (show 111)
実行結果:
111
あるいは:
module Main where
main = putStr $ show 111
実行結果:
111
あるいは [[print 関数>http://www.haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v%3Aprint]]を使う:
module Main where
main = print 111
実行結果:
111
*関数
**その1
module Main where
addStar s = "*" ++ s ++ "*"
main = putStr $ addStar "aaa"
実行結果:
*aaa*
**その2
module Main where
add x y = x + y
main = putStr $ show $ add 1 2
実行結果:
3