めも。
■ghc
wget http://www.haskell.org/ghc/dist/7.2.2/ghc-7.2.2-x86_64-unknown-linux.tar.bz2 tar xvfj ghc-7.2.2-x86_64-unknown-linux.tar.bz2 cd ghc-7.2.2 ./configure --prefix=/usr/local/haskell/ghc/7.2.2 make install export PATH=/usr/local/haskell/ghc/7.2.2/bin:$PATH
コーディング
vim hello.hs
main = putStrLn "Hello World"
実行
以下のコマンドでコンパイルと実行が同時にできる。
ghc -e main hello.hs
もしくは以下のコマンドを実行する。
ghc --make hello.hs ./hello
インタプリタ
以下のコマンドで起動する。
ghci
以下のようにしてインストールできる。
Prelude> putStrLn "Hello World" Hello World
以下のようにしてインタプリタを終了できる。
<ctrl>+D
エラー
<command line>: can't load .so/.DLL for: libgmp.so (libgmp.so: cannot open shared object file: No such file or directory)
以下のコマンドで解決できる。
cd /usr/lib64 ln -s libgmp.so.3 libgmp.so
参考
■hugs
インタプリタ。ghciもあるので必要がないと思われる。
wget http://cvs.haskell.org/Hugs/downloads/2006-09/hugs98-Sep2006.tar.gz tar xvzf hugs98-Sep2006.tar.gz cd hugs98-Sep2006 ./configure make make install
開始
hugs
終了
<ctrl>+D
Hello World
Hugs> putStrLn "Hello World" Hello World