GHCi doesn't remember let-less function declarations with -fobject-code
GHCi supports two styles of function declaration: those using an explicit let
keyword, and those without. This GHCi session demonstrates both:
$ /opt/ghc/8.2.1/bin/ghci
GHCi, version 8.2.1: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/Documents/Hacking/Haskell/trifecta/.ghci
Loaded GHCi configuration from /home/rgscott/.ghci
λ> let foo1 :: Int; foo1 = 42
λ> foo1
42
λ> foo2 :: Int; foo2 = 42
λ> foo2
42
But if using GHCi with the -fobject-code
enabled, then the let
-less style of declaration no longer works:
$ /opt/ghc/8.2.1/bin/ghci -fobject-code
GHCi, version 8.2.1: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/Documents/Hacking/Haskell/trifecta/.ghci
Loaded GHCi configuration from /home/rgscott/.ghci
λ> let foo1 :: Int; foo1 = 42
λ> foo1
42
λ> foo2 :: Int; foo2 = 42
λ> foo2
<interactive>:4:1: error:
• Variable not in scope: foo2
• Perhaps you meant ‘foo1’ (line 1)
Originally noticed here.
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHCi |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |