Haskell

Debian supplies lots of packages for Haskell. Bullseye supplies version 8.8.4 of the compiler, which is new enough for me, so I'm just going to install haskell-platform.

sudo apt install haskell-platform
sudo apt install haskell-platform-doc haskell-platform-prof

It suggested the docs and profiling tools too.

❯ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.8.4

Now I want to get the Haskell language server so I can use it from Emacs. This is analogous to rust-analyzer for Rust or gopls for Go.

I downloaded the pre-built binaries for Linux.

cd ~/.local/bin

wget https://github.com/haskell/haskell-language-server/releases/download/1.4.0/haskell-language-server-Linux-8.8.4.gz
gunzip haskell-language-server-Linux-8.8.4.gz
chmod +x haskell-language-server-Linux-8.8.4
ln -s haskell-language-server-Linux-8.8.4 haskell-language-server

wget https://github.com/haskell/haskell-language-server/releases/download/1.4.0/haskell-language-server-wrapper-Linux.gz
gunzip haskell-language-server-wrapper-Linux.gz
chmod +x haskell-language-server-wrapper-Linux
ln -s haskell-language-server-wrapper-Linux haskell-language-server-wrapper

That's the server itself. To configure Emacs to use it, I installed lsp-haskell

M-x package-install RET lsp-haskell RET

and changed my ~/.emacs.d/config/programming/haskell.el file to use it

(require 'lsp)
(require 'lsp-haskell)
;; Hooks so haskell and literate haskell major modes trigger LSP setup
(add-hook 'haskell-mode-hook #'lsp)
(add-hook 'haskell-literate-mode-hook #'lsp)

Emacs lsp-mode makes Emacs configuration really nice!

Emacs with Haskell LSP

Here is some literate Haskell code from @haskellhutt. That stuff on the right hand side is not part of the file; Emacs got it from the Haskell language server. Keen!