-
-
Notifications
You must be signed in to change notification settings - Fork 389
eval action crashes server when optics are involved #663
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
Not sure if this will be fixed by #438, but is this not supported now, @pepeiborra? |
Well, that's interesting :-) #438 uses the same evaluation logic as the current implementation (apart from some minor changes) so it also crashes. |
Good to hear that it's not my local problem @tittoassini 🙂 PS: I would have tried to verify it on a Linux server, but I have no idea how to trigger the evaluation from CLI/Vim 😕 |
@xsebek what lsp client are you using for vim? You need to look for a code lens action - that triggers the evaluation |
I have MacVim 8.2 locally with Coc, which works, but I could not find all features such as code lens. (It's not in CocAction at least) |
This is a server problem, not a client one. Unfortunately, the server log doesn't provide any hint. The module is loaded OK and then during execution, it crashes. Maybe optics use Template Haskell? @pepeiborra might know more. |
@tittoassini optics do allow you to create lenses with TH, but I tried this with optics-core (AFAIK TH-Free) with same results. |
@tittoassini @googleson78 have you managed to repro? I could not repro on MacOs with 8.8.4 nor 8.10.2 |
strange, I could reproduce it with 8.10.2 |
Okay, so not every optic is a problem:
-- >>> lens y (\p i -> p {y = i}) %~ (+1) $ (Point 0 0)
-- Point {x = 0, y = 1}
-- >>> _Right %~ (-1+) $ Right 5 :: Either String Int
-- Left 4 It would be nice if tuple optics worked because they don't seem to use anything prohibited and are very useful. 🥺 If there is any way I can help with this issue, let me know @pepeiborra 😉 |
Hi @xsebek, the first thing to do would be to write a PR with a few tests so that we can see exactly what is crashing the server and what isn't and what versions/platforms are affected. |
That might be beyond me @tittoassini - current functional testing of eval plugin does not seem to include other packages. @pepeiborra I minimized the example and pushed it to GitHub xsebek/test-hls-eval-optics |
@tittoassini you were right that extended eval plugin does not change this. 😞 -- >>> (\(a,b,c) -> (succ a,b,c)) (0,2,3) -- OK
-- >>> (_1 %~ succ) (0, 2, 3) -- STILL NOT OK
-- >>> (1,2,3) -- ALSO NOT OK
-- >>> someFunc -- STILL NOT OK
someFunc :: (Int, Int, Int)
someFunc = (_1 %~ succ) (0, 2, 3) Which was expected, I guess. 🤷 If you want to check the updated LSP output with messages it's in the repo (line before crash). 🙂 |
Hi, I just remembered this old issue and retried with the current HLS and it now works without issue. 🥳 No idea what fixed this or when but I am happy to close this. 🙂 |
Your environment
$ haskell-language-server-wrapper --probe-tools haskell-language-server version: 0.6.0.0 (GHC: 8.10.1) (PATH: /Users/xsebek/.ghcup/bin/haskell-language-server-wrapper-0.6.0) (GIT hash: 372a12e797069dc3ac4fa33dcaabe3b992999d7c) Tool versions found on the $PATH cabal: 3.2.0.0 stack: Not found ghc: 8.10.2
Which lsp-client do you use: VS Code
Describe your project: Simple
cabal init
with added dependency onoptics
and changedMainLib.hs
:Contents of
hie.yaml
:Steps to reproduce
Run eval action on expression with optic or function which contains them, for example:
Expected behaviour
Should evaluate the action as if
_1 %~ succ
was\(a,b,c) -> (succ a,b,c)
Actual behaviour
The eval crashes the server:
The same thing happens with evaluating the lens directly.
Include debug information
Execute in the root of your project the command
haskell-language-server --debug .
and paste the logs here:Debug output:
Paste the logs from the lsp-client, e.g. for VS Code
LSP logs:
The text was updated successfully, but these errors were encountered: