Skip to content

Latest commit

 

History

History
148 lines (107 loc) · 3.4 KB

editor_setup.md

File metadata and controls

148 lines (107 loc) · 3.4 KB
title author
Haskell Editor Setup
Matt Wraith

Haskell Editor Survey Results

We're going to do the top 4.

  1. Emacs
  2. Vim
  3. VSCode
  4. Atom

Haskell IDE Comparison Chart

Install stack

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

ghcid

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

Emacs

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)

Vim

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

VSCode

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

Atom

$ 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

General Advice

  • 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.

Summary