1

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..

KammO
  • 21
  • 3
  • 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 Nov 05 '21 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 Nov 05 '21 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 Nov 05 '21 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 Nov 07 '21 at 11:42
  • Same problem here, any fix I can do? – patpat Feb 12 '22 at 12:00
  • hi patpat. I am aware of your request. Im busy today and the issue is a bit old. Ill review the steps I took to solve tomorrow morning and post the result here. You may have solved the issue by then anyway :) – KammO Feb 13 '22 at 12:23
  • I'm experiencing an issue with a very similar error message: Error (haskell-mode-local-vars-hook): Error running hook "lsp!" because: (invalid-function lsp!) This error is being followed by this error: Error (hack-local-variables-hook): Error running hook "doom-run-local-var-hooks-h" because: (doom-hook-error haskell-mode-local-vars-hook lsp! (invalid-function lsp!)) I'm wondering if the original poster has managed to fix this issue somehow? The language server seems to be working, but everytime a new Haskell file is opened, the error dialog is shown. – John Doe Apr 13 '22 at 19:30
  • Regarding request for solutions to the original question I posted: it may depend on the OS you are running (I am on Arch). I would suggest that you ensure that the haskell-mode-hook is enabled and is functioning correctly in emacs Dante (see: https://github.com/jyp/dante). Also make sure that GHCi is setup correctly on your platform and that emacs is talking to it OK – KammO Apr 15 '22 at 07:47

1 Answers1

0

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

ron
  • 101
  • 1