[GHC] #16096: let x = ... and x = ... are not the same in GHCi

GHC ghc-devs at haskell.org
Wed Dec 26 04:34:17 UTC 2018


#16096: let x = ... and x = ... are not the same in GHCi
-------------------------------------+-------------------------------------
           Reporter:  osa1           |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  GHCi           |           Version:  8.6.3
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 With #7253 we implemented support for `x = ...` in GHCi which is supposed
 to do the same thing as `let x = ...`, but they're currently different, as
 observed in #16089, #15721, and probably in other tickets. Here's a
 reproducer:

 {{{
 ~ $ ghci -ddump-bcos
 GHCi, version 8.4.4: http://www.haskell.org/ghc/  :? for help

 ...

 λ:1> let x = [True,False]

 ==================== Proto-BCOs ====================
 ProtoBCO ExprTopLevel_E0#0 []:
    let sat_s1vF = ... in ...
    bitmap:  0 []
    PUSH_G   GHC.Types.[]
    PUSH_G   GHC.Types.False
    PACK     : 2
    PUSH_L   0
    PUSH_G   GHC.Types.True
    PACK     : 2
    PUSH_G   GHC.Types.[]
    PUSH_L   1
    PACK     : 2
    PUSH_L   0
    PUSH_APPLY_P
    PUSH_G   GHC.Base.returnIO
    SLIDE    3 3
    ENTER


 λ:2> x = [True,False]

 ==================== Proto-BCOs ====================
 ProtoBCO x1_r1wJ#0 []:
    GHC.Types.:
      @ GHC.Types.Bool GHC.Types.False (GHC.Types.[] @ GHC.Types.Bool)
    bitmap:  0 []
    PUSH_G   GHC.Types.[]
    PUSH_G   GHC.Types.False
    PACK     : 2
    ENTER

 ProtoBCO Ghci2.x#0 []:
    GHC.Types.: @ GHC.Types.Bool GHC.Types.True x1_r1wJ
    bitmap:  0 []
    PUSH_G   x1_r1wJ
    PUSH_G   GHC.Types.True
    PACK     : 2
    ENTER

 ...
 }}}

 Expected behavior: these two should generate the same byte code, and
 should be subject to same checks (e.g. for shadowing).

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


More information about the ghc-tickets mailing list