[GHC] #12091: 'Variable not in scope" when using GHCi with `-fobject-code`

GHC ghc-devs at haskell.org
Fri May 20 18:28:12 UTC 2016


#12091: 'Variable not in scope" when using GHCi with `-fobject-code`
-------------------------------------+-------------------------------------
        Reporter:  thomie            |                Owner:
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:
       Component:  GHCi              |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #7253             |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by osa1):

 I know the problem but I don't know how to fix it. `let x = ...` is
 compiled as
 a statement, `x = ...` is compiled as a declaration. Desugarer dumps
 unused
 declarations if the target is not `HscInterpreted` or `HscNothing` (see
 `DynFlags.targetRetainsAllBindings`), but nothing like that is done for
 statements. Since `-fobject-code` sets target something other than
 `HscInterpreted` and `HscNothing`, `x` gets dumped.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12091#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list