73 lines
2.7 KiB
Org Mode
73 lines
2.7 KiB
Org Mode
#+TITLE: lang/haskell
|
|
#+DATE: January 16, 2017
|
|
#+SINCE: v0.7
|
|
#+STARTUP: inlineimages
|
|
|
|
* Table of Contents :TOC:
|
|
- [[#description][Description]]
|
|
- [[#maintainers][Maintainers]]
|
|
- [[#module-flags][Module Flags]]
|
|
- [[#plugins][Plugins]]
|
|
- [[#prerequisites][Prerequisites]]
|
|
- [[#features][Features]]
|
|
- [[#configuration][Configuration]]
|
|
|
|
* Description
|
|
Adds Haskell support to Doom Emacs.
|
|
|
|
** Maintainers
|
|
This module has no dedicated maintainers.
|
|
|
|
** Module Flags
|
|
+ =+lsp= Enable LSP support with for [[https://github.com/haskell/haskell-language-server][haskell-language-server]] (requires the =:tools lsp= module).
|
|
|
|
** Plugins
|
|
+ [[https://github.com/haskell/haskell-mode][haskell-mode]]
|
|
+ [[https://github.com/emacs-lsp/lsp-haskell][lsp-haskell]] (=+lsp=, =:tools lsp=)
|
|
|
|
* Prerequisites
|
|
It is recommended to install the haskell tooling using [[https://www.haskell.org/ghcup/][ghcup]]. Only ghc is needed
|
|
for basic functionality:
|
|
|
|
#+BEGIN_SRC bash
|
|
ghcup install ghc
|
|
#+END_SRC
|
|
|
|
but =+lsp= users should also install the language server:
|
|
|
|
#+BEGIN_SRC bash
|
|
ghcup install hls
|
|
#+END_SRC
|
|
|
|
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=.
|
|
|
|
=haskell-mode= provides support for [[https://github.com/ndmitchell/hoogle][hoogle]], which can be installed through
|
|
system package manager, cabal, or stack.
|
|
|
|
=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.
|
|
|
|
* 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:
|
|
|
|
| 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 |
|
|
|
|
* Configuration
|
|
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"))
|
|
#+END_SRC
|