docs(haskell): rewrite readme
A lot of it was outdated, and now it conforms to the readme template.
This commit is contained in:
parent
a20cd88e8e
commit
d1555257a8
1 changed files with 36 additions and 93 deletions
|
@ -5,126 +5,69 @@
|
||||||
|
|
||||||
* Table of Contents :TOC:
|
* Table of Contents :TOC:
|
||||||
- [[#description][Description]]
|
- [[#description][Description]]
|
||||||
- [[#external-resources][External resources]]
|
- [[#maintainers][Maintainers]]
|
||||||
- [[#module-flags][Module Flags]]
|
- [[#module-flags][Module Flags]]
|
||||||
- [[#plugins][Plugins]]
|
- [[#plugins][Plugins]]
|
||||||
- [[#prerequisites][Prerequisites]]
|
- [[#prerequisites][Prerequisites]]
|
||||||
- [[#cabal][Cabal]]
|
- [[#features][Features]]
|
||||||
- [[#lsp-haskell-language-server][LSP (haskell-language-server)]]
|
|
||||||
- [[#stack][Stack]]
|
|
||||||
- [[#haskell-packages][Haskell packages]]
|
|
||||||
- [[#configuration][Configuration]]
|
- [[#configuration][Configuration]]
|
||||||
- [[#using-the-new-style-cabal-repl][Using the new-style cabal REPL]]
|
|
||||||
- [[#troubleshooting][Troubleshooting]]
|
|
||||||
|
|
||||||
* Description
|
* Description
|
||||||
This module adds [[https://www.haskell.org/][Haskell]] support, powered by LSP
|
Adds Haskell support to Doom Emacs.
|
||||||
(haskell-language-server).
|
|
||||||
|
|
||||||
+ Code completion (~company-ghc~)
|
** Maintainers
|
||||||
+ Look up documentation (~hoogle~)
|
This module has no dedicated maintainers.
|
||||||
+ REPL (~ghci~)
|
|
||||||
+ Syntax-checking (~flycheck~)
|
|
||||||
+ [[https://github.com/hlissner/doom-snippets/tree/master/haskell-mode][Snippets]]
|
|
||||||
|
|
||||||
** External resources
|
|
||||||
Here are a few resources I've found indispensable in my Haskell adventures:
|
|
||||||
|
|
||||||
+ [[http://learnyouahaskell.com/][Learn you a haskell for great good]]
|
|
||||||
+ [[http://haskellbook.com/][Haskell Programming from first principles]]
|
|
||||||
+ [[https://github.com/krispo/awesome-haskell][Awesome Haskell]]: an extensive list of haskell resources
|
|
||||||
+ [[https://docs.haskellstack.org/en/stable/README/][The Haskell Tool Stack docs]]
|
|
||||||
|
|
||||||
** Module Flags
|
** Module Flags
|
||||||
+ =+lsp= Enables LSP support with haskell-language-server (requires the ~:tools lsp~ module).
|
+ =+lsp= Enable LSP support with for [[https://github.com/haskell/haskell-language-server][haskell-language-server]] (requires the =:tools lsp= module).
|
||||||
|
|
||||||
** Plugins
|
** Plugins
|
||||||
+ [[https://github.com/haskell/haskell-mode][haskell-mode]]
|
+ [[https://github.com/haskell/haskell-mode][haskell-mode]]
|
||||||
+ =+lsp=
|
+ [[https://github.com/emacs-lsp/lsp-haskell][lsp-haskell]] (=+lsp=, =:tools lsp=)
|
||||||
+ [[https://github.com/emacs-lsp/lsp-haskell][lsp-haskell]]
|
|
||||||
|
|
||||||
* Prerequisites
|
* Prerequisites
|
||||||
|
It is recommended to install the haskell tooling using [[https://www.haskell.org/ghcup/][ghcup]]. Only ghc is needed
|
||||||
|
for basic functionality:
|
||||||
|
|
||||||
+ LSP users need the =haskell-language-server= LSP server
|
#+BEGIN_SRC bash
|
||||||
+ All users will need the =hoogle= package
|
ghcup install ghc
|
||||||
|
|
||||||
** Cabal
|
|
||||||
*** MacOS
|
|
||||||
#+BEGIN_SRC sh
|
|
||||||
brew install cabal-install ghc
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
*** Arch Linux
|
but =+lsp= users should also install the language server:
|
||||||
#+BEGIN_SRC sh
|
|
||||||
sudo pacman -S cabal-install ghc
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
*** openSUSE
|
|
||||||
#+BEGIN_SRC sh :dir /sudo::
|
|
||||||
sudo zypper install cabal-install ghc
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
** LSP (haskell-language-server)
|
|
||||||
You will need =stack= and =git= installed.
|
|
||||||
|
|
||||||
You will find a comprehensive [[https://github.com/haskell/haskell-language-server#installation][instructions for haskell-language-server on its project page]], but if you are using [[https://www.haskell.org/ghcup/][ghcup]]:
|
|
||||||
|
|
||||||
#+BEGIN_SRC bash
|
#+BEGIN_SRC bash
|
||||||
ghcup install hls
|
ghcup install hls
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Stack
|
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
|
||||||
To use LSP, you need =stack=:
|
=ghcup=.
|
||||||
|
|
||||||
*** MacOS
|
=haskell-mode= provides support for [[https://github.com/ndmitchell/hoogle][hoogle]], which can be installed through
|
||||||
#+BEGIN_SRC sh
|
system package manager, cabal, or stack.
|
||||||
brew install haskell-stack
|
|
||||||
stack setup
|
|
||||||
#+END_SRC
|
|
||||||
*** Arch Linux
|
|
||||||
#+BEGIN_SRC sh
|
|
||||||
sudo pacman -S stack
|
|
||||||
# Replace pacaur with your AUR package manager of choice
|
|
||||||
pacaur -S ncurses5-compat-lib
|
|
||||||
stack setup
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
*** openSUSE
|
=haskell-language-server= provides support for [[https://github.com/ndmitchell/hlint/][hlint]], and haskell code
|
||||||
#+BEGIN_SRC sh :dir /sudo::
|
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]],
|
||||||
sudo zypper install stack
|
which can be installed through system package manager, cabal, or stack.
|
||||||
stack setup
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
** Haskell packages
|
* Features
|
||||||
You'll need to install the following packages using ~stack~ or ~cabal~:
|
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:
|
||||||
|
|
||||||
+ =hoogle=
|
| Keybinding | Description |
|
||||||
#+BEGIN_SRC sh
|
|-------------------+-----------------------------------------------|
|
||||||
cabal update
|
| =<localleader> b= | Build the current cabal project |
|
||||||
cabal install happy haskell-src-exts # ghc-mod/hoogle dependencies
|
| =<localleader> c= | Visit the =.cabal= file of the current buffer |
|
||||||
cabal ghc-mod hoogle
|
| =<localleader> h= | Toggle visibility of the form at point |
|
||||||
# or
|
| =<localleader> H= | hides all top level functions |
|
||||||
stack install ghc-mod
|
|
||||||
stack install hoogle
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
And ensure the binaries for these packages are in your ~PATH~, e.g.
|
|
||||||
|
|
||||||
#+BEGIN_SRC sh
|
|
||||||
# place this in your profile file, like ~/.bash_profile or ~/.zshenv
|
|
||||||
export PATH="~/.local/bin:$PATH"
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
* Configuration
|
* Configuration
|
||||||
** Using the new-style cabal REPL
|
After installing your preferred formatter, make sure to set
|
||||||
=haskell-mode= will typically detect what REPL to run based on your project
|
=lsp-haskell-formatting-provider= to it.
|
||||||
(e.g. stack, (old-style) cabal or ghc). If you want the new-style cabal REPL you
|
|
||||||
must set ~haskell-process-type~ manually:
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
Make sure to configure the lsp to use your perfered formatter, e.g.:
|
||||||
(setq haskell-process-type 'cabal-new-repl)
|
#+BEGIN_SRC elisp
|
||||||
|
;; ~/.doom.d/config.el
|
||||||
|
(after!
|
||||||
|
(setq lsp-haskell-formatting-provider "brittany"))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
* Troubleshooting
|
|
||||||
+ Stack users: a ~dist/setup-config~ file in your project may cause [[https://github.com/DanielG/ghc-mod/wiki#known-issues-related-to-stack][ghc-mod to
|
|
||||||
not work]].
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue