doomemacs/modules/lang/haskell/README.org
Itai Y. Efrat 6f2e05ea76 refactor!(haskell): remove ghcide support
BREAKING CHANGE: ghcide was archived a while back and now primarily
exists as a library used in the development of haskell-language-server.
It is not recommended for end-users, only for development. To this end I
think including it in the module is more misleading than helpful, and
the people that really want to use it can easily set it up themselves.

Ref: https://github.com/haskell/ghcide/pull/939
2021-09-15 01:56:26 +03:00

4.3 KiB

lang/haskell

Description

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

  • 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.
  • +lsp Enables LSP support with haskell-language-server (requires the :tools lsp module).

Plugins

Prerequisites

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

  • Dante users need cabal, ghc and ghc-mod
  • LSP users need the haskell-language-server LSP server
  • 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-language-server)

You will need stack and git installed.

You will find a comprehensive instructions for haskell-language-server on its project page, but if you are using ghcup:

ghcup install hls

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