First, we have to setup lsp-mode. Then, we will setup haskell-mode that provides syntax highlighting for Haskell source files, and lsp-haskell for LSP services.
haskell-mode setup
I prefer module management. So I create a file lisp/haskell.el, and write
1 | (use-package haskell-mode |
lsp-mode setup
Also, lsp-haskell is not pre-configured by lsp-mode. That means we should manually setup executable file for hls. In lisp/lsp.el (where I put my use-package lsp-mode), add
1 | :custom |
lsp-haskell setup
Then in init.el, we have to manually enable lsp-haskell, lsp-mode and haskell-mode. Note that, since our haskell.el uses add-hook, so it should be evaluated after lsp-mode.
1 | (require 'lsp) |
And that’s it!