ubuntuなので、sudo apt-get install ghc6 で完了。
emacsの設定
http://projects.haskell.org/haskellmode-emacs/ から2.8.0をダウンロード。
ローカルに展開する。
.emacsに以下の設定を追加。
(add-to-list 'load-path (expand-file-name "~/prog/haskell/haskell-mode-2.8.0"))
(load "haskell-site-file")
(setq haskell-program-name "/usr/bin/ghci")
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
(add-hook 'haskell-mode-hook 'font-lock-mode)
(add-hook 'haskell-mode-hook 'imenu-add-menubar-index)
M-x run-haskellで起動。
起動直後
--------------------------------------------------------------------
File Edit Options Buffers Tools Errors Complete In/Out Signals Help
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
-uuu:---F1 *scratch* All (5,0) (Lisp Interaction)----1:27午前 Mail---
GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude>
-uuu:**-F1 *haskell* All (5,9) (Inf-Haskell:run Compilation)----1:27$
Loading /home/shingo/prog/haskell/haskell-mode-2.8.0/inf-haskell.el (source)...\
done
--------------------------------------------------------------------
上のバッファでコードを書いて test.hs で保存。
C-c C-l で転送。
--------------------------------------------------------------------File Edit Options Buffers Tools Errors Complete In/Out Signals Help
foo x y = x + y
-uuu:---F1 test.hs All (2,0) (Haskell Ind Doc)----1:28午前 Mail----
GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :load "/home/shingo/test.hs"
[1 of 1] Compiling Main ( /home/shingo/test.hs, interpreted )
Ok, modules loaded: Main.
*Main> foo 1 2
3
*Main>
-uuu:**-F1 *haskell* All (10,7) (Inf-Haskell:run Compilation)----1:28$
--------------------------------------------------------------------
今日はここまで。
0 件のコメント:
コメントを投稿