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
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
最終更新:2007年01月17日 22:17