doomemacs/modules/lang/haskell
2020-05-12 20:07:11 -04:00
..
+dante.el Merge pull request #2685 from kenranunderscore/change-obsolete-binding 2020-03-09 14:04:25 -04:00
+lsp.el Minor refactor & reformatting across the board 2020-04-08 15:30:10 -04:00
autoload.el lang/haskell: remove intero support 2020-04-14 19:27:33 -04:00
config.el Remap haskell-mode-jump-to-def-or-tag to +lookup/definition 2020-05-12 20:07:11 -04:00
doctor.el lang/haskell: remove intero support 2020-04-14 19:27:33 -04:00
packages.el lang/haskell: remove intero support 2020-04-14 19:27:33 -04:00
README.org lang/haskell: remove intero support 2020-04-14 19:27:33 -04:00

lang/haskell

Description

This module adds Haskell support, powered by either dante (the default) or LSP (haskell-language-server or ghcide).

  • Code completion (company-ghc)
  • Look up documentation (hoogle)
  • eldoc support (dante)
  • REPL (ghci)
  • Syntax-checking (flycheck)
  • Code navigation (dante)
  • Snippets

External resources

Here are a few resources I've found indispensable in my Haskell adventures:

Module Flags

  • +dante Enables dante; a fork of intero aimed at lightweightedness. It doesn't depend on stack, supports both cabal-only and stack projects, but lacks eldoc support.
  • +ghcide Enables LSP support with ghcide (requires the :tools lsp module).
  • +lsp Enables LSP support with haskell-ide-engine (requires the :tools lsp module).

Plugins

Prerequisites

Depending on whether you use Dante, haskell-language-server or ghcide, your dependencies will differ:

  • Dante users need cabal, ghc and ghc-mod
  • LSP users need the haskell-ide-engine LSP server OR ghcide
  • All users will need the hoogle package

Cabal

To use Dante, you need cabal (the haskell package builder) and ghci (the compiler, syntax checker & repl):

MacOS

brew install cabal-install ghc

Arch Linux

sudo pacman -S cabal-install ghc

openSUSE

sudo zypper install cabal-install ghc

LSP (haskell-ide-engine)

You will need stack and git installed.

You will find a comprehensive install guide for haskell-ide-engine on its project page, but here's a TL;DR:

MacOS

haskell-ide-engine must be build and installed manually on MacOS, e.g.

git clone https://github.com/haskell/haskell-ide-engine
cd haskell-ide-engine
make

Arch Linux

haskell-ide-engine-git is available on the AUR

yay -S haskell-ide-engine-git

LSP (ghcide)

See https://github.com/digital-asset/ghcide for install instructions.

Stack

To use LSP, you need stack:

MacOS

brew install haskell-stack
stack setup

Arch Linux

sudo pacman -S stack
# Replace pacaur with your AUR package manager of choice
pacaur -S ncurses5-compat-lib
stack setup

openSUSE

sudo zypper install stack
stack setup

Haskell packages

You'll need to install the following packages using stack or cabal:

  • (Dante users) ghc-mod

    stack install ghc-mod
    # or
    cabal install ghc-mod
  • hoogle

    cabal update
    cabal install happy haskell-src-exts   # ghc-mod/hoogle dependencies
    cabal ghc-mod hoogle
    # or
    stack install ghc-mod
    stack install hoogle

And ensure the binaries for these packages are in your PATH, e.g.

# place this in your profile file, like ~/.bash_profile or ~/.zshenv
export PATH="~/.local/bin:$PATH"

Configuration

Using the new-style cabal REPL

haskell-mode will typically detect what REPL to run based on your project (e.g. stack, (old-style) cabal or ghc). If you want the new-style cabal REPL you must set haskell-process-type manually:

(setq haskell-process-type 'cabal-new-repl)

Troubleshooting