过去几天我一直在尝试学习 Haskell,所以终于到了设置我的环境的时候了。因此,我安装了 Haskell Platform 和 cabal。
我的编辑器是 emacs,我的操作系统是 Windows。
我从 github 下载了 ghc-mod 的 master 分支,并使用 cabal 安装了依赖项,然后构建了项目。一切顺利,可执行文件似乎工作。
命令喜欢ghc-mod --version
或ghc-mod boot
按预期工作。
然后,我在 emacs 上安装了 haskell-mode 并修改了 .emacs 以使用 ghc。但是当我试图打开一个 Haskell 文件时,emacs 冻结说“正在初始化......”。
问题是什么?
GHC 版本:7.10.2 cabal 版本:1.22.6.0 使用 cabal 库的 1.22.4.0 版本 ghc-mod 版本:5.3.0.0 由 GHC 7.10.2 编译
编辑 1:16/8/2015 11:10
这是我添加到我的行.emacs
:
; haskell-mode
(add-hook 'haskell-mode-hook 'haskell-indentation-mode)
; ghc-mod for haskell
; I added to list path to ghc elisp file because I read somewhere that that's
; better than installing it from MELPA. I DID try to install it from melpa
; though. Didn't solve anything.
(add-to-list `load-path "~/cabal/x86_64-windows-ghc-7.10.2/ghc-mod-5.3.0.0/elisp")
(autoload 'ghc-init "ghc" nil t)
(autoload 'ghc-debug "ghc" nil t)
(add-hook 'haskell-mode-hook (lambda () (ghc-init)))
当我第一次尝试打开 haskell 文件时,Emacs 冻结。所以我猜它在里面堆积了一个无限循环ghc-init()
。
编辑 2:16/8/2015 21:16
输出ghc-debug
在这里