-
-
Notifications
You must be signed in to change notification settings - Fork 388
Full-feature liquid haskell plugin #367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Afaik liquid haskell functionality will be included in the ghc itself. If it needs some adaptation in the ide i guess it should be in ghcide, as linear type errors will be reported directly by ghc. So a dedicated plugin only would be needed to support older ghc versions. Imo we should only invest in the ghc builtin functionality. |
Can you share source on that? I've only seen liquid haskell ghc plugin. |
@Anrock thanks for the correction, i had assimilated incorrectly refinement and linear types (but the former subsumes the latter? or did i imagine its relation entirely?) |
@jneira afaik refinement and linear types are unrelated in this sense. But I may be wrong. |
Linear types is a type extension in GHC. LiquidHaskell is a plugin static checker, but one that wires itself quite closely to the internals of GHC. They're quite different, although can express some of the same properties (but not that many). |
Yes, LH is a plugin, and not part of GHC as such. Not sure this is the right place -- but I haven't been able to get the LH plugin to work with the According to @kosmikus this is a macos issue because he is able to get the basic support Currently I work around this by:
Any suggestions on how I can help provide more information as to why |
@ranjitjhala have you started encountering this after ucsd-progsys/liquidhaskell@86f48a6 ? Because we always set |
It's quite possible that I haven't checked after we merged the Haddock fix. I will try. Also, just to clarify, @ranjitjhala: I'm by no means certain this is a MacOS issue. You've been observing double-conversion-related duplicate symbol errors in your logs, and I've been saying that I recall having seen this on MacOS once before, but never on Linux. Regarding the original purpose of this issue (sorry, I had not noticed this issue): I have created a proof-of-concept "full" LH plugin for haskell-language-server. It's proof-of-concept right now primarily because it reads annotation info from the place LH naturally writes it to, which is in a Apart from this issue, the plugin is working. I hope I'll be able to submit a PR at some point. |
I fixed the |
@ranjitjhala The output of running @kosmikus could you possibly share what you have so far? I've started work on my own LH plugin, but I'm primarily interested in taking advantage of the synthesis abilities of LH for the IDE. |
@wz1000 https://github.com/kosmikus/haskell-language-server/tree/liquid-plugin This is based on @alanz 's plugin for haskell-ide-engine and totally unpolished so far. |
@wz1000 So in particular, the only feature it adds is to use the annotations LH generates for giving refinement type signatures as part of hover. There's lot of cool other things that could in principle be done, including indeed synthesis. |
Hi all, this gist shows the contents of the |
Here's a second log, https://gist.github.com/ranjitjhala/d37fb858fd38ea9f8bdddc8a19840fec that I got just now by firing up vscode on this haskell package (the https://github.com/ucsd-progsys/lh-plugin-demo/tree/hls AFAICT it builds LH but then something is causing the process to get killed... |
As suggested I ran the server locally:
so looks like a segfault? |
@ranjitjhala have been some progress in the liquid plugin? thanks! |
Hi @jneira -- hmm not sure what the blockage was here, my impression was there was some glitch in the GHCi API, not so much the liquid-plugin? @kosmikus or @adinapoli do you recall? |
Yes, I think this was some transient failure specific to your machine, IIRC. I have tried using the plugin both on Mac and Linux around the time it was first developed and it worked just fine. I guess we should try to give things a shot now and report back 😉 |
I am not sure if this is the right issue to ask, but given that it seems that having it as a plugin seems to work, and I believe this relates to HLS-LH integration. Is HLS able to see Currently, it seems that while HLS passes the error produced by LH, it is otherwise transparent to its presence. |
I agree, it's not clear what if anything we need to do here. It should mostly Just Work, since GHC knows about it. |
@michaelpj Yes, however, that issue persists, but it might not be a HLS issue... Maybe the culprit is the VSCode extension. I don't know much about LSPs, but my guess is that what happens is that the VSCode extension doesn't recognize that annotation, so it goes:
But maybe it is:
In which case the issue would be HLS. |
I had time to read a bit more of the source code of both, and see now that the VSCode extension is a very thin client, I believe the issue is in HLS. Could this part of code be relevant in this issue? haskell-language-server/ghcide/src/Development/IDE/Plugin/TypeLenses.hs Lines 308 to 317 in 10b5f3b
I am not sure on the specifics or whether this is relevant or not since I am unfamiliar with the codebase, but this seems promising... If the way HLS tells if something has a signature or not is by consulting the |
properties :: Properties '[ 'PropertyKey "mode" (TEnum Mode)] We have three options here |
If there's a specific issue with using HLS with GHC then maybe open a specific issue for that? Type signature lenses work off GHC's diagnostic for missing type signatures, so is GHC giving you a warning for that? |
Apologies, after digging a little further I believe this to, in general, be for the better. HLS should show lenses for such functions (annotated by LH), since LH works on top of the inferred signatures. The behaviour I sought after would only be useful in the trivial cases. And as you said, GHC does indeed give warnings for such functions. A principled solution to this (if one were to be desired) would have to be implemented in the Liquid Haskell side. |
There is now a liquid haskell GHC typechecker plugin. This has some level of support in ghcide, but needs first class hover etc support.
Ping @kosmikus . More detail/requirements please
cc @ranjitjhala
The text was updated successfully, but these errors were encountered: