Skip to content
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

runInterpreter regression in 0.9.0.6 for GHC < 9.2 #149

Open
brandon-leapyear opened this issue Jun 15, 2022 · 0 comments
Open

runInterpreter regression in 0.9.0.6 for GHC < 9.2 #149

brandon-leapyear opened this issue Jun 15, 2022 · 0 comments

Comments

@brandon-leapyear
Copy link
Collaborator

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 = ()"}])
[...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant