2019-04-07 16:46:59 -04:00
#+TITLE : lang/haskell
#+DATE : January 16, 2017
#+SINCE : v0.7
#+STARTUP : inlineimages
2017-05-25 20:08:50 +02:00
2019-04-07 16:46:59 -04:00
* Table of Contents :TOC:
- [[#description ][Description ]]
2021-08-03 20:58:35 +03:00
- [[#maintainers ][Maintainers ]]
2019-04-07 16:46:59 -04:00
- [[#module-flags ][Module Flags ]]
- [[#plugins ][Plugins ]]
- [[#prerequisites ][Prerequisites ]]
2021-08-03 20:58:35 +03:00
- [[#features ][Features ]]
2019-04-07 16:46:59 -04:00
- [[#configuration ][Configuration ]]
* Description
2021-08-03 20:58:35 +03:00
Adds Haskell support to Doom Emacs.
** Maintainers
This module has no dedicated maintainers.
2019-04-07 16:46:59 -04:00
** Module Flags
2021-08-03 20:58:35 +03:00
+ =+lsp= Enable LSP support with for [[https://github.com/haskell/haskell-language-server ][haskell-language-server ]] (requires the =:tools lsp= module).
2019-04-07 16:46:59 -04:00
** Plugins
+ [[https://github.com/haskell/haskell-mode ][haskell-mode ]]
2021-08-03 20:58:35 +03:00
+ [[https://github.com/emacs-lsp/lsp-haskell ][lsp-haskell ]] (=+lsp= , =:tools lsp= )
2019-04-07 16:46:59 -04:00
* Prerequisites
2021-08-03 20:58:35 +03:00
It is recommended to install the haskell tooling using [[https://www.haskell.org/ghcup/ ][ghcup ]]. Only ghc is needed
for basic functionality:
2019-04-07 16:46:59 -04:00
2021-08-03 20:58:35 +03:00
#+BEGIN_SRC bash
ghcup install ghc
2019-08-27 10:50:37 +02:00
#+END_SRC
2021-08-03 20:58:35 +03:00
but =+lsp= users should also install the language server:
2017-10-18 17:55:04 +02:00
2020-03-29 18:28:20 -04:00
#+BEGIN_SRC bash
2020-09-24 23:15:37 +08:00
ghcup install hls
2017-10-18 17:55:04 +02:00
#+END_SRC
2021-08-03 20:58:35 +03:00
Installing [[https://www.haskell.org/cabal/ ][cabal ]] or [[https://docs.haskellstack.org/en/stable/README/ ][stack ]] as well is recommended, and can be done through
=ghcup= .
2019-12-01 05:13:10 -05:00
2021-08-03 20:58:35 +03:00
=haskell-mode= provides support for [[https://github.com/ndmitchell/hoogle ][hoogle ]], which can be installed through
system package manager, cabal, or stack.
2019-12-01 05:13:10 -05:00
2021-08-03 20:58:35 +03:00
=haskell-language-server= provides support for [[https://github.com/ndmitchell/hlint/ ][hlint ]], and haskell code
formatters such as [[https://github.com/lspitzner/brittany ][brittany ]], [[https://github.com/ennocramer/floskell ][floskell ]], [[https://github.com/tweag/ormolu ][ormolu ]], [[https://github.com/fourmolu/fourmolu ][fourmolu ]], and [[https://github.com/haskell/stylish-haskell ][stylish-haskell ]],
which can be installed through system package manager, cabal, or stack.
2019-04-07 16:46:59 -04:00
2021-08-03 20:58:35 +03:00
* Features
This module intergrates the haskell packages into Doom by providing things such
as repl support, project root recognition, etc. It also provide the following
keybindings:
2019-04-07 16:46:59 -04:00
2021-08-03 20:58:35 +03:00
| Keybinding | Description |
|-------------------+-----------------------------------------------|
| =<localleader> b= | Build the current cabal project |
| =<localleader> c= | Visit the =.cabal= file of the current buffer |
| =<localleader> h= | Toggle visibility of the form at point |
| =<localleader> H= | hides all top level functions |
2017-10-18 17:55:04 +02:00
2019-04-07 16:46:59 -04:00
* Configuration
2021-08-03 20:58:35 +03:00
After installing your preferred formatter, make sure to set
=lsp-haskell-formatting-provider= to it.
Make sure to configure the lsp to use your perfered formatter, e.g.:
#+BEGIN_SRC elisp
;; ~/.doom.d/config.el
(after!
(setq lsp-haskell-formatting-provider "brittany"))
2019-04-07 16:46:59 -04:00
#+END_SRC