Codelens eval should not interact with IO
Subject of the issue
-- >>> getChar actually returns a value. It seems to be reading the characters from the link between the server and editor. However it does not seem to cause any crashes or ruin the link, on my editor at least. putStr etc. might also possibly be doing something unexpected although it does not seem to produce any noticeable effects on the editor.
Your environment
neovim 4.4, coc.nvim.
The codelens eval should perhaps perform some pre-processing and get rid of any IO first, just to be safe.
Perhaps std{in,err,out} can be redirected or something, but I think it can still be useful to have IO in examples (e.g. IORefs/MVars)
@podocarp do you agree that handling std would be enough to make safe io calls?
Sorry, I'm not an expert in Haskell so I'm the wrong person to be asking. However handling it still sounds like a good idea. I would think that things like getLine however would have to be blocked altogether because it makes no sense in the first place.
I arrived here via:
- #4506
The current documentation for hls-eval-plugin states:
IO expressions can also be evaluated but their output to stdout/stderr is NOT captured:
>>> print "foo"()
However, on current Windows 11, with current Visual Studio Code and Haskell extension (v2.6.1), current Stack, HLS 2.11.0.0 (the latest available via GHCup) and GHC 9.10.2 (as HLS 2.11.0.0 does not support GHC 9.10.3):
-- >>> print "foo"
is stuck at Evaluate... regardless of any request to evaluate.
(In the same source file, at the same time, something like -- >>> "foo" evaluates as expected.)