intellij haskell 插件使用分享

intellij haskell 插件使用分享

intellij haskell 插件使用分享

Haskell语言编程的ide有eclipse,intellij idea, vim,vscode等,还有一个leksah。

对于leksah由于没有读过用户手册虽然有安装过,但不知道是怎么用的,vim有配置过,用起来还可以,但做为一个ide来说是比不上intellij idea的(自我感觉)

这个文章主要分享一下自己配置和使用intellij hasekll插件的经过及感受。

intellij hasekll的github链接是:https://github.com/rikvdkleij/intellij-haskell/blob/master/README.md

插件安装步骤是:

1, 在电脑上安装stack工具,stack 链接是:https://docs.haskellstack.org/en/stable/README/

2,配置stack的源为清华的源,我使用的stack版本的配置地址是C:\sr\config.yaml

tuna源配置是:

setup-info: "http://mirrors.tuna.tsinghua.edu.cn/stackage/stack-setup.yaml"
urls:
latest-snapshot: http://mirrors.tuna.tsinghua.edu.cn/stackage/snapshots.json
lts-build-plans: http://mirrors.tuna.tsinghua.edu.cn/stackage/lts-haskell/
nightly-build-plans: http://mirrors.tuna.tsinghua.edu.cn/stackage/stackage-nightly/

package-indices:
- name: Tsinghua
download-prefix: http://mirrors.tuna.tsinghua.edu.cn/hackage/package/
http: http://mirrors.tuna.tsinghua.edu.cn/hackage/00-index.tar.gz

3, 使用stack安装  hindent, stylish-haskell 这两个工具,

4,intellij idea的 file -> setting ->plugins 在搜索框输入intellij-hasekll (或输入haskell然后选择intellij-hasekll),点击install重启idea

5,选择idea的file -> setting -> Other Settings -> Haskell 配置 hindent, stylish-haskell 的位置

(注:这里需要注意Background REPL timeout in seconds 的值,需要设置的大一点,我设置是600,因为我发现我的win10的Windwos Defender在导入stack工程的时候占用cpu导至导入过程被卡,我的解决办法是,将实时防护关闭,并将timeout值设置的大一点)

6,使用stack new 命令创建工程,并且要保证工程可以编译通过没有错误,否则在导入到idea中的时候会出现问题(编译命令 stack build)

7, 选择idea的 File>New>Project from Existing Sources... 然后选择 Import project from external model and check Haskell Stack;

8,导入项目的时候,idea会重新编译工程,并会下载一些源代码,还会生成Hoogle数据库(虽然我不知道这个是用来干什么的),如果中间有什么失败,可以选择 Tools>Restart Haskell Stack REPLs  和 Tools> (re)build hoogle database

原文地址http://www.bieryun.com/2495.html