title | author |
---|---|
Haskell Editor Setup |
Matt Wraith |
We're going to do the top 4.
- Emacs
- Vim
- VSCode
- Atom
https://docs.haskellstack.org/en/stable/install_and_upgrade/
$ curl -sSL https://get.haskellstack.org/ | sh
or
$ apt/brew install haskell-stack
$ pacman -S stack
then
$ stack upgrade
You may need to add $HOME/.local/bin
to your PATH
:
$ export PATH=$HOME/.local/bin:$PATH
Everybody can use ghcid. It's a fantastic tool that compiles in the terminal.
$ stack install ghcid
How to use:
$ cd /path/to/your/stack/project
$ ghcid
Intero gives you a lot of power. Flychecking code. Querying types of subexpressions:
(package-install 'haskell-mode)
(package-install 'intero)
(require 'haskell)
(require 'haskell-mode)
(require 'intero)
(intero-global-mode 1)
;; If you want to set indentation for spaces
(add-hook 'haskell-mode-hook 'haskell-indentation-mode)
(setq haskell-indentation-layout-offset 4
haskell-indentation-left-offset 4)
Ale works well with newest vim:
Plug 'w0rp/ale'
...
let g:ale_set_quickfix = 1
let g:ale_linters = {
\ 'haskell': ['stack-ghc'],
\}
If you use neovim, you can also get intero and ghcid plugins:
Plug 'ndmitchell/ghcid', { 'rtp': 'plugins/nvim' }
Plug 'parsonsmatt/intero-neovim'
...
let g:intero_use_neomake = 0 " neomake seems to conflict with ale
For more info on intero-neovim: https://github.com/parsonsmatt/intero-neovim
Install https://marketplace.visualstudio.com/items?itemName=Vans.haskero
For all projects that use Haskero, you must:
$ cd /path/to/your/stack/project
$ stack build intero
$ apm install atom-haskell
https://atom-haskell.github.io/
or for a more minimal install:
apm install language-haskell ide-haskell ide-haskell-cabal ide-haskell-repl
- You probably want stack, but it's possible to use cabal or nix or the Haskell Platform.
- Everybody can use ghcid. It's very fast and simple.
- ghc-mod only works well for small projects. It will bog down your editor if you're not careful. This is maybe a problem with the Atom plugin.
- Emacs -> haskell-mode + intero
- vim -> ale with stack-ghc linter
- neovim -> ghcid + intero
- VSCode -> Haskero (docs)
- Atom -> atom-haskell (simpler subset of atom-haskell: ide-haskell + ide-haskell-cabal)