I am running Xmonad window manager together with Xmobar on ArchLinux 5.14.12-arch1-1. I have ghc, cabal, and stack installed. Suddenly Doom has started having a problem with Haskell files and is returning with:

'Error (haskell-mode-vars-hook): Error running hook "lsp!" because: (invalid-function-lsp!)'.

I have an another machine with exactly the same version of ArchLinux and Haskell installed and Doom reads Haskell files without any problems at all.

I have tried running Doom upgrade, sync and doctor and installing the haskell-language-server. I have also re-installed emacs, doom and ghc completely but the problem remains. Doom also seems to have a problem with all the Xmonad imports in the xmonad.hs configuration file stating that key packages such as xmonad-contrib etc are missing. However, all Xmonad packages are installed on the machine and the Xmonad/Xmobar window manager functionality is working perfectly. What am I missing? Thx in advance..

  • Try running M-x toggle-debug-on-error. This should put you in the debugger looking at a stack trace next time the error happens. Include the stack in your question.
    – db48x
    Commented Nov 5, 2021 at 19:43
  • The error occurs when loading files into the editor not when executing them. M-x toggle-debug-on-error generates no further debug messages other than the one in my original post. I note however that Dante appears not to be starting the ghci when loading the file; this despite the (haskell +dante) modules being enabled in doom init.el..
    – KammO
    Commented Nov 5, 2021 at 22:25
  • If the error is not coming from Emacs, but from ghci or the program itself, then this isn’t really an Emacs question. The error mentions LSP though, so perhaps it is just that your LSP server is not installed or working correctly.
    – db48x
    Commented Nov 5, 2021 at 23:17
  • Everything was fine working with Haskell files until 5 days ago. I reinstalled an OS backup from 6 days ago on two different machines. Again no problems editing Haskell files. Then I upgraded the doom emacs installation: '~/.emacs.d/bin/doom upgrade' and the same problem occurred again on both machines. Ghci continues to work fine in both alacritty and vim. Also, with the last 4 days Haskell released quite a few upgrades. Given that Arch Linux is a rolling distro its starting to look like a mismatch between Haskell implementation in doom upgrade and the Haskell rolling release in Arch
    – KammO
    Commented Nov 7, 2021 at 11:42
  • Same problem here, any fix I can do?
    – patpat
    Commented Feb 12, 2022 at 12:00

1 Answer 1


Not sure if helps, but I could fix this by uncommenting lsp in the :tools section of init.el.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.