2

I'm trying to setup the Neovim plugin https://github.com/mrcjkb/haskell-tools.nvim for a while now and I don't see any progress. I mostly want this plugin for Haskell CodeLenses, so that I can write a comment

module Test (fact) where

fact :: Integer -> Integer
fact 0 = 1
fact n = n * fact (n-1)

fact5 :: Integer
fact5 = fact 5
-- >>> 

and the plugin would add the result of fact5 (120) after -- >>>.

I'm on NixOS and tried both, setting it up with Lazy.nvim and with Nix as the plugin installer. I will attach a minimal configuration using Lazy.nvim plugin manager where only those two plugins are installed.

In all three versions (My full config with Lazy.nvim, My full config where Nix home-manager installs packages, Minimal config with Lazy.nvim) I have the same behaviour:

  • I can open the interactive repl as a Neovim Window above my buffer with :Haskell repl toggle and the keymaps shown on the GitHub page (so the plugin and the keymaps get loaded)
  • When I type :Hls start for starting haskell-language-server nothing happens. The command is still in the prompt and nothing changes. Same with :Hls evalAll and others.
  • The plugin displays grey text right after -- >>> namely "Evaluate..." but never finishes with the evaluation
  • The keybinding for code actions tells me that no actions are available
  • When I remove the line fact5 :: Integer and use the keymap for code lenses it adds this line right above.

I don't know what else I could try so I'm very happy about recommendations.

Versions

NixOS: 25.05 – Info from flake.lock, for nixpkgs:

nixpkgs:
   "narHash": "sha256-zyEsoxHTMIbyYWpc4n+jiKwZ9TcIE4DPotdxAe2Jrso=",
   "rev": "0ee3848fea3e9c7dadf47cf1e89f8c13878e9f6f",
   ...

lazy-lock.json

{
  "haskell-tools.nvim": { "branch": "master", "commit": "5fb8eda3c4430cb1d473d3e2138b070bdca1c224" },
  "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }
}

Checkhealth

I exported the result of :checkhealth with :TOhtml, I don't notice interesting errors either https://heureka-code.github.io/haskell-tools-question/checkhealth.html

Files

I uploaded them to GitHub: https://github.com/heureka-code/haskell-tools-question

Thanks in advance! hc

1 Answer 1

4
fact5 :: Integer
fact5 = fact 5
-- >>> 

and the plugin would add the result of fact5 (120) after -- >>>.

That's not how haskell-language-server's doctest evaluation works. It's evaluating nothing, because there's nothing after the -- >>> to evaluate.

You want something like this:


-- | >>> fact 5
fact :: Integer -> Integerfact 0 = 1
fact n = n * fact (n-1)
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much! -- >>> fact 5 worked for me.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.