haskell-language-server icon indicating copy to clipboard operation
haskell-language-server copied to clipboard

Support for (the Liquid Haskell and other) GHC plugins

Open nikivazou opened this issue 3 months ago • 11 comments

Hey, I am trying to setup LHS to work with the Liquid Haskell GHC plugin (it worked in the past, but stopped after upgrades). My understanding is that LHS for efficiency ignores the GHC plugin flags set up in the *.cabal file, is that correct? If so, is there a way to force such plugins?

Thanks a lot!

nikivazou avatar Sep 29 '25 07:09 nikivazou

Hi!

It would be news to me that HLS ignores the GHC plugins for any reasons. Ignoring typechecker plugins would make HLS incorrect, right? It should still work just like usual. Are you encountering any error messages?

HLS should still work with liquid haskell, I can give it a try later this week or at the beginning of next week and report back.

fendor avatar Sep 29 '25 12:09 fendor

So, if in my *.cabal file I have ghc-options: -fplugin=LiquidHaskell, LHS should run the plugin or there is also a different place I can add it? Differently, is there a way to check what exactly is the command LHS is running?

Would be helpful if you try it to run it too! Let me know if I can help!

nikivazou avatar Sep 30 '25 06:09 nikivazou

Ok, so I checked out the example repository https://github.com/ucsd-progsys/lh-plugin-demo

Currently, I see the error:

(TypeCheck,NormalizedFilePath "/home/dain/Documents/haskell/lh-plugin-demo/src/Demo/Erase.hs")not used by HLS/home/dain/.ghcup/ghc/9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-linux-ghc-9.12.2-16c3/libHSghc-prim-0.13.0-00de-ghc9.12.2.so

in my HLS session... Can you confirm similar errors or do you see other errors in your liquid haskell projects?

fendor avatar Oct 06 '25 17:10 fendor

Thanks!!!!!

I confirm! The error I get is

(TypeCheck,NormalizedFilePath "/Users/niki.vazou/Desktop/rp-liquid-tutorial/src/Light.hs")not used by HLS/Users/niki.vazou/.ghcup/ghc/9.12.2/lib/ghc-9.12.2/lib/../lib/x86_64-osx-ghc-9.12.2-6757/libHSghc-prim-0.13.0-f079-ghc9.12.2.dylib compiler

nikivazou avatar Oct 07 '25 08:10 nikivazou

This might be related to this bug report: https://github.com/haskell/haskell-language-server/issues/4631

I will have a look :)

fendor avatar Oct 07 '25 08:10 fendor

Hey @fendor, did you manage to resolve it? :)

nikivazou avatar Oct 23 '25 10:10 nikivazou

Not yet, I am still looking into it!

fendor avatar Oct 23 '25 10:10 fendor

Ok! Let me know if you need feedback! Thanks!!!!

nikivazou avatar Oct 23 '25 10:10 nikivazou

It looks like this only fails with GHC 9.12, but not with ghc 9.10.

fendor avatar Oct 31 '25 11:10 fendor

I think I've fixed this in #4749:

Image

fendor avatar Oct 31 '25 11:10 fendor

Thanks!!!!! I will try it soon!

nikivazou avatar Nov 03 '25 08:11 nikivazou