main = putStrLn "Hello, World" 본문

Programming

main = putStrLn "Hello, World"

halatha 2009. 1. 31. 10:07
http://haskell.springnote.com

1. install(Ubuntu, http://ubuntuprogramming.wikidot.com/haskell)

$ sudo apt-get install ghc6

2. compile mode
$ vi hello.hs
main = putStrLn "Hello, World"

$ ghc --make hello
[1 of 1] Compiling Main             ( hello.hs, hello.o )
Linking hello ...
$ ./hello
Hello, World
$

3. interpreter mode
$ ghci
GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
Loading package base ... linking ... done.
Prelude> let fact x = product[1..x]
Prelude> fact 5
120
Prelude> :q
Leaving GHCi.
$
Comments