emacs Haskell配置
来源:互联网 发布:python中字符串的 编辑:程序博客网 时间:2024/06/05 13:31
Interactive commands
As usual, enabling a new feature in the Haskell mode involves changing some configuration file. In particular, we need to enable the interactive features and also define the key bindings to be used. Opening the configuration file is becoming normal for you now, so do so and add:
(custom-set-variables '(haskell-process-suggest-remove-import-lines t) '(haskell-process-auto-import-loaded-modules t) '(haskell-process-log t))(eval-after-load 'haskell-mode '(progn (define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-or-reload) (define-key haskell-mode-map (kbd "C-c C-z") 'haskell-interactive-switch) (define-key haskell-mode-map (kbd "C-c C-n C-t") 'haskell-process-do-type) (define-key haskell-mode-map (kbd "C-c C-n C-i") 'haskell-process-do-info) (define-key haskell-mode-map (kbd "C-c C-n C-c") 'haskell-process-cabal-build) (define-key haskell-mode-map (kbd "C-c C-n c") 'haskell-process-cabal)))(eval-after-load 'haskell-cabal '(progn (define-key haskell-cabal-mode-map (kbd "C-c C-z") 'haskell-interactive-switch) (define-key haskell-cabal-mode-map (kbd "C-c C-k") 'haskell-interactive-mode-clear) (define-key haskell-cabal-mode-map (kbd "C-c C-c") 'haskell-process-cabal-build) (define-key haskell-cabal-mode-map (kbd "C-c c") 'haskell-process-cabal)))
Note that the key bindings deviates from the ones in the wiki. The reason to do so is to avoid conflicts with key bindings in ghc-mode
and HaRe.
A piece of advice: if you are using a modern version of Cabal (more than 1.18), you should use its integrated REPL capabilities instead of ghci
. This will ensure that your projects stay sandboxed, instead of polluting the global database. To enable it, add
(custom-set-variables '(haskell-process-type 'cabal-repl))
to your personal configuration file. If you are using Stack as your build tool, you can also choose to use it for the REPL by writing instead:
(custom-set-variables '(haskell-process-type 'stack-ghci))
In both cases, if your personal configuration file already has a custom-set-variables
command, you'll need to instead add a blank space and then '(haskell-process-type 'chosen-process-type)
before its closing parenthesis.
As always, once you're done editing this file, save it and M-x eval-buffer RET
to apply the changes to your running Emacs session.
In order to use the rest of the features in haskell-mode
, you need to establish a connection with an interpreter, which can be then queried for information about your file. This is called loading a file, and it's done by running C-c C-l
in the file. You will be asked about the root of the Cabal project, which should be auto-configured for you anyway, and then you will get a interpreter window with a λ>
prompt.
One reason for the error `The Haskell process `haskell' has died. Restart?'is that Emacs cannot find the location of the GHCi executable. Thefollowing fix will find this location and add it to the Emacs path.Note that the solution given is only for OS X / Linux, and it has onlybeen tested on OS X. Windows installations of Haskell don't seem to havethis problem - if yours does, try the same fix, but with "where" in placeof "which". Also note that any number of problems seem to produce the sameerror, so this is not guaranteed to work (but when done correctly seemedto work for most students at the session on Friday). * Open a terminal. * execute the following command:which ghci * If you get an error from this command, Haskell has not been installed correctly. Otherwise, note the response given (eg. `/opt/local/bin/ghci') * The path that must be added to the Emacs path is the above response, but with `/ghci' removed (eg. `/opt/local/bin'). * Copy the following two lines to the end of your Emacs config file:(setenv "PATH" (concat (getenv "PATH") ":HERE"))(setq exec-path (append exec-path '("HERE"))) * Replace HERE with the path described above. * Restart Emacs.Note that the Emacs config file is usually located at the path `~/.emacs'.You can also access the Emacs config file by executing the following withinEmacs:M-: (find-file user-init-file)
(setq haskell-program-name "/some/where/ghci.exe")
- emacs Haskell配置
- Haskell配置
- Emacs的haskell-mode的安装
- emacs配置.emacs
- emacs配置
- emacs 配置
- emacs 配置
- emacs配置
- Emacs配置
- Emacs 配置
- Emacs配置
- emacs配置
- emacs配置
- Emacs配置
- emacs 配置
- emacs配置
- Emacs配置
- emacs配置
- ubifs文件系统的移植
- 关于Android安卓APP保活
- PHP的常见ORM特性初探
- Java中对象的序列化与反序列化
- PyCharm新建.py文件时默认添加作者时间等信息
- emacs Haskell配置
- Android 下载别人的demon 无法运行的问题解决
- sql语句随机数字
- 日常做题(每天一道)十一月的
- 在当前android 项目中混用Kotlin代码。
- vue单页面组件工程创建
- There was an unexpected error (type=Not Found, status=404). /kind/WEB-INF/page//kindEditor.jsp
- JVM调优之jstack找出最耗cpu的线程并定位代码
- 爬虫入门:爬取CSDN每天都的访问量并发送邮件到邮箱