这可能是最傻瓜化的在vscode下的haskell配置介绍文章为什么要写这篇文章?在自己写搭建环境的过程中,搜了一些博文,有些真的及其不服责任和敷衍,草草几句话就带过,但是在google上排名还很高,带着一种鄙视这些文章的态度,于是写下这篇文章,希望给后面的人有帮助安装haskell我的平台:deepin-15.8,基于debian8,(ubuntu等应该这里是一份haskell的学习指南,粗略介绍了安装,资源等一些东西根据上面链接的内容,我们可以得知:不推荐使用Haskell-platform直接安装也不太推荐使用cabel更推荐使用stack安装官网安装文档安装For many Un*x operating systems, all you need to do is run://对于unix类系统curl -sSL https://get.haskellstack.org/ | shor:wget -qO- https://get.haskellstack.org/ | sh(对于windows系统)On Windows, you can download and install the Windows 64-bit Installer.创建你的project:stack new my-projectcd my-projectstack setupstack buildstack exec my-project-exeThe stack new command will create a new directory containing all the needed files to start a project correctly.The stack setup will download the compiler if necessary in an isolated location (default /.stack) that won’t interfere with any system-level installations. (For information on installation paths, please use the stack path command.).The stack build command will build the minimal project.stack exec my-project-exe will execute the command.If you just want to install an executable using stack, then all you have to do is stack install <package-name>.注意,linux系统最好将/.local/bin加入PATH中换源毕竟源在国外,所以我们首先必须要进行换源,幸好清华大学开源网站镜像站有提供,更具体一点可以看Stackage 镜像使用说明,这里记录下vim ~/.stack/config.yaml# addpackage-indices:- name: Tsinghua download-prefix: https://mirrors.tuna.tsinghua.edu.cn/hackage/package/ http: https://mirrors.tuna.tsinghua.edu.cn/hackage/00-index.tar.gzsetup-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/# 开始使用stack,这个命令需要稍稍等待stack setup# 安装完成之后stack ghci# 会出现以下输出Configuring GHCi with the following packages:GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for helpLoaded GHCi configuration from /private/var/folders/0s/j3c0tlx10z9_x9wzhl14xmgh0000gn/T/ghci11066/ghci-scriptPrelude>搭建vscode打开vscode,下载extension,这里我推荐这四个插件:Haskell Syntax Highlighting、Haskell ghc-mod 、haskell-linter、Haskelly,其中第四个插件离不开stack。 要想使用以上插件,必须安装以下几个包:# for Haskell ghc-mod stack install ghc-mod# for haskell-linterstack install hlint# for Haskellystack install interostack install QuickCheckstack install stack-run安装时可能出现问题ghc-mod安装时如果报错stackoverflow上的解决办法我采用了stack install ghc-mod –resolver lts-8.24去解决stack-run安装报错github issueI found a workaround.Create a file: ~/.stack/global-project/stack-cabal-1.24.yamlflags: {}extra-package-dbs: []packages: []extra-deps: []resolver: lts-8.24Basically it’s using an old stack lts that was from around the time the last update to stack-run was >made.Then just run this:stack –stack-yaml ~/.stack/global-project/stack-cabal-1.24.yaml install stack-runand it should work (did for me, at least)intero安装报错stack install intero –resolver lts-8.24去解决vscode 插件配置然后打开vscode的配置文件,加上ghc-mod和hlint的路径,如下:“haskell.ghcMod.executablePath”: “/home/.local/bin/ghc-mod”,“haskell.hlint.executablePath”: “/home/.local/bin/hlint”