2022-03-28 15:03:21 +02:00
#+title : :lang haskell
#+subtitle : A language that's lazier than I am
#+created : March 29, 2016
#+since : 0.9
2021-10-16 01:28:32 +02:00
* Description :unfold:
This module adds Haskell support to Doom Emacs.
2021-08-03 20:58:35 +03:00
** Maintainers
2022-08-04 16:02:49 +02:00
- [[doom-user: ][@iyefrat ]]
[[doom-contrib-maintainer: ][Become a maintainer? ]]
2021-10-16 01:28:32 +02:00
** Module flags
- +lsp ::
Enable LSP support for ~haskell-mode~ . Requires [[doom-module: ][:tools lsp ]] and a langserver
(supports [[https://github.com/haskell/haskell-language-server ][haskell-language-server ]]).
2021-08-03 20:58:35 +03:00
2021-10-16 01:28:32 +02:00
** Packages
- [[doom-package: ][haskell-mode ]]
- [[doom-package: ][lsp-haskell ]] if [[doom-module: ][+lsp ]]
2019-04-07 16:46:59 -04:00
2021-10-16 01:28:32 +02:00
** Hacks
/No hacks documented for this module./
* Installation
[[id:01cffea4-3329-45e2-a892-95a384ab2338 ][Enable this module in your ~doom!~ block. ]]
2019-04-07 16:46:59 -04:00
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-10-16 01:28:32 +02:00
#+begin_src sh
2021-08-03 20:58:35 +03:00
ghcup install ghc
2021-10-16 01:28:32 +02:00
#+end_src
2019-08-27 10:50:37 +02:00
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
2021-10-16 01:28:32 +02:00
#+begin_src sh
2020-09-24 23:15:37 +08:00
ghcup install hls
2021-10-16 01:28:32 +02:00
#+end_src
2017-10-18 17:55:04 +02:00
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-10-16 01:28:32 +02:00
* TODO Usage
#+begin_quote
🔨 /This module's usage documentation is incomplete./ [[doom-contrib-module: ][Complete it? ]]
#+end_quote
This module integrates the haskell packages into Doom by providing things such
as REPL support, project root recognition, etc. It also provide the following
2021-08-03 20:58:35 +03:00
keybindings:
2019-04-07 16:46:59 -04:00
2021-10-16 01:28:32 +02:00
| Keybinding | Description |
|-----------------+-----------------------------------------------|
| [[kbd:][<localleader> b]] | Build the current cabal project |
| [[kbd:][<localleader> c]] | Visit the =.cabal= file of the current buffer |
| [[kbd:][<localleader> h]] | Toggle visibility of the form at point |
| [[kbd:][<localleader> H]] | hides all top level functions |
* TODO Configuration
#+begin_quote
🔨 /This module's configuration documentation is incomplete./ [[doom-contrib-module: ][Complete it? ]]
#+end_quote
2017-10-18 17:55:04 +02:00
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.:
2021-10-16 01:28:32 +02:00
#+begin_src emacs-lisp
2021-08-03 20:58:35 +03:00
;; ~/.doom.d/config.el
2022-01-04 15:43:12 +11:00
(after! lsp-haskell
2021-08-03 20:58:35 +03:00
(setq lsp-haskell-formatting-provider "brittany"))
2021-10-16 01:28:32 +02:00
#+end_src
* Troubleshooting
/There are no known problems with this module./ [[doom-report: ][Report one? ]]
* Frequently asked questions
/This module has no FAQs yet./ [[doom-suggest-faq: ][Ask one? ]]
* TODO Appendix
#+begin_quote
🔨 This module has no appendix yet. [[doom-contrib-module: ][Write one? ]]
#+end_quote