doomemacs/modules/lang/haskell
Henrik Lissner a3e262c7ac
💥 Refactor add-hook! macro & change arg order
This update may potentially break your usage of add-hook! if you pass
the :local or :append properties to it. This is how they used to work:

  (add-hook! :append 'some-mode-hook #'do-something)

Thsoe properties must now follow the hooks, e.g.

  (add-hook! 'some-mode-hook :append #'do-something)

Other changes:
- Various add-hook calls have been renamed to add-hook! because I
  incorrectly assumed `defun` always returned its definition's symbol,
  when in fact, its return value is "undefined" (so sayeth the
  documentation). This should fix #1597.
- This update adds the ability to add multiple functions to hooks
  without a list:

    (add-hook! 'some-mode-hook
               #'do-something
               #'do-something-else)

- The indentation logic has been changed so that consecutive function
  symbols at indented at the same level as the first argument, but forms
  are indent like a defun.

    (add-hook! 'some-mode-hook
               #'do-something
               #'do-something-else)

    (add-hook! 'some-mode-hook
      (message "Hello"))
2019-07-26 20:17:29 +02:00
..
+dante.el
+intero.el
+lsp.el
autoload.el
config.el 💥 Refactor add-hook! macro & change arg order 2019-07-26 20:17:29 +02:00
doctor.el
packages.el
README.org

lang/haskell

Description

This module adds Haskell support, powered by either intero (the default), dante or LSP.

  • 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 indespensible in my Haskell adventures:

Module Flags

  • +intero Enables intero; a comprehensive, stack-based development environment for Haskell.
  • +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.
  • +lsp Enables lsp-haskell (this requires the :tools lsp to be enabled).

Plugins

Prerequisites

Depending on whether you use Intero, Dante or LSP, your dependencies will differ:

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

Stack

To use Intero, 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

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

LSP

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

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