Open
Description
runInterpreter
in 0.9.0.6 with GHC < 9.2 on a module that fails to compile will send errors to stderr and return Left (UnknownError "Got no error message")
instead of Left (WontCompile ...)
.
This currently fails with vanilla lts-19.11
, but I wanted to verify across GHC versions as well. This is the script I used to test this:
for hint_version in 0.9.0.5 0.9.0.6; do
for ghc_version in 8.10 9.0 9.2; do
echo "##########################"
echo "hint: ${hint_version}, ghc: ${ghc_version}";
echo -e "import Language.Haskell.Interpreter\nrunInterpreter $ loadModules [\"Foo.hs\"]" | stack ghci --resolver lts-19.11 --package hint-${hint_version} --compiler ghc-${ghc_version}
done
done
on this file:
x :: Int
x = ()
##########################
hint: 0.9.0.5, ghc: 8.10
[...]
Left (WontCompile [GhcError {errMsg = "Foo.hs:2:5: error:\n \8226 Couldn't match expected type \8216Int\8217 with actual type \8216()\8217\n \8226 In the expression: ()\n In an equation for \8216x\8217: x = ()"},GhcError {errMsg = "Foo.hs:2:5: error:\n \8226 Couldn't match expected type \8216Int\8217 with actual type \8216()\8217\n \8226 In the expression: ()\n In an equation for \8216x\8217: x = ()"}])
[...]
##########################
hint: 0.9.0.5, ghc: 9.0
[...]
Left (WontCompile [GhcError {errMsg = "Foo.hs:2:5: error:\n \8226 Couldn't match expected type \8216Int\8217 with actual type \8216()\8217\n \8226 In the expression: ()\n In an equation for \8216x\8217: x = ()"},GhcError {errMsg = "Foo.hs:2:5: error:\n \8226 Couldn't match expected type \8216Int\8217 with actual type \8216()\8217\n \8226 In the expression: ()\n In an equation for \8216x\8217: x = ()"}])
[...]
##########################
hint: 0.9.0.5, ghc: 9.2
[...]
Left (WontCompile [GhcError {errMsg = "Foo.hs:2:5: error:\n \8226 Couldn't match expected type \8216Int\8217 with actual type \8216()\8217\n \8226 In the expression: ()\n In an equation for \8216x\8217: x = ()"},GhcError {errMsg = "Foo.hs:2:5: error:\n \8226 Couldn't match expected type \8216Int\8217 with actual type \8216()\8217\n \8226 In the expression: ()\n In an equation for \8216x\8217: x = ()"}])
[...]
##########################
hint: 0.9.0.6, ghc: 8.10
[...]
Foo.hs:2:5: error:
• Couldn't match expected type ‘Int’ with actual type ‘()’
• In the expression: ()
In an equation for ‘x’: x = ()
|
2 | x = ()
| ^^
Foo.hs:2:5: error:
• Couldn't match expected type ‘Int’ with actual type ‘()’
• In the expression: ()
In an equation for ‘x’: x = ()
|
2 | x = ()
| ^^
Left (UnknownError "Got no error message")
[...]
##########################
hint: 0.9.0.6, ghc: 9.0
[...]
Foo.hs:2:5: error:
• Couldn't match expected type ‘Int’ with actual type ‘()’
• In the expression: ()
In an equation for ‘x’: x = ()
|
2 | x = ()
| ^^
Foo.hs:2:5: error:
• Couldn't match expected type ‘Int’ with actual type ‘()’
• In the expression: ()
In an equation for ‘x’: x = ()
|
2 | x = ()
| ^^
Left (UnknownError "Got no error message")
[...]
##########################
hint: 0.9.0.6, ghc: 9.2
[...]
Left (WontCompile [GhcError {errMsg = "Foo.hs:2:5: error:\n \8226 Couldn't match expected type \8216Int\8217 with actual type \8216()\8217\n \8226 In the expression: ()\n In an equation for \8216x\8217: x = ()"},GhcError {errMsg = "Foo.hs:2:5: error:\n \8226 Couldn't match expected type \8216Int\8217 with actual type \8216()\8217\n \8226 In the expression: ()\n In an equation for \8216x\8217: x = ()"}])
[...]
Metadata
Metadata
Assignees
Labels
No labels