[GHC] #14108: GHCi doesn't remember let-less function declarations with -fobject-code
GHC
ghc-devs at haskell.org
Fri Aug 11 14:41:31 UTC 2017
#14108: GHCi doesn't remember let-less function declarations with -fobject-code
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: GHCi | Version: 8.2.1
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: GHC rejects
Unknown/Multiple | valid program
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
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
[https://github.com/ekmett/trifecta/pull/73#issuecomment-321829537 here].
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14108>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list