Using rec statement in GHCi causes GHC internal error
Summary
Attempting to use a rec
statement in GHCi causes a variable not in scope error.
Steps to reproduce
In GHCi, with -XRecursiveDo
enabled, use a bare rec
statement that binds at least one variable.
Example:
$ ghci
GHCi, version 9.0.1: https://www.haskell.org/ghc/ :? for help
ghci> :set -XRecursiveDo
ghci> rec x <- pure ()
<interactive>:2:1: error:
GHC internal error: ‘x’ is not in scope during type checking, but it passed the renamer
tcl_env of environment: []
Expected behavior
I'm not 100% sure this should work. If it should, I would expect the rec
statement to be equivalent to
it's mfix
desugaring specified by the user's guide.
If this is not supposed to work for some reason, I would expect a non-internal (and hopefully more helpful) error message.
Environment
- GHC versions used: 9.0.1 and 9.2.1-alpha1