Description
Your environment
OS: macOS 13.2.1 (22D68)
GHC: 9.8.1, and 9.8.2
LSP: 2.2.0.0, 2.5.0.0, 2.6.0.0, 2.7.0.0, and head
LSP Plugin: hls-eval-plugin
Steps to reproduce
I tried a number of of combinations of GHC/LSP/file setup, but it seems that with GHC 9.8.x any time when there's a main
function present in the module, the result after evaluation is Prelude.head: empty list
.
E.g.
module Test where
-- >>> 'x'
main :: IO ()
main = putStrLn "Hello World!"
Expected behaviour
module Test where
-- >>> 'x'
-- 'x'
main :: IO ()
main = putStrLn "Hello World!"
Actual behaviour
module Test where
-- >>> 'x'
-- Prelude.head: empty list
main :: IO ()
main = putStrLn "Hello World!"
Debug information
After a bit of debugging myself, I found the error originating from this use of head
. After a bit of tinkering, it seems that the underlying hscParsedDecls function, which TyThings
output is [Identifier `$trModule']
, rather than the expected [Identifier `evalPrint', Identifier `$trModule']
.
As the problem seems to arise from the GHC, I am not quite sure whether there's a bug in GHC, or Eval plugin implementation is working under the wrong assumptions.
I am happy to try to fix this if someone is able to provide some additional direction/advice.