[GHC] #13277: When type classes are redefined in GHCi bindings that use old instances are still accessible

GHC ghc-devs at haskell.org
Thu Feb 16 00:13:37 UTC 2017


#13277: When type classes are redefined in GHCi bindings that use old instances are
still accessible
-------------------------------------+-------------------------------------
        Reporter:  deech             |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  GHCi              |              Version:  8.0.1
      Resolution:  invalid           |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  Other             |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by simonpj):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 No, this is by design.  Consiider
 {{{
 Prelude> let x = 3
 Prelude> let y = x+4
 Preluce> (\x -> y) 72
 8
 Prelude> let x = "hello"
 Prelude> y
 8
 }}}
 The value of `y` is `x+4` where `x`'s value comes from the binding site of
 `y`.  The fact that `x` now has a totally different value (72, or "hello"
 in the two examples) is irrelevant.

 Same with `f` above.  Its value is 1 regardless of what other bindings you
 bring into scope subsequently.

 Does that make sense?

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


More information about the ghc-tickets mailing list