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

GHC ghc-devs at haskell.org
Sun Feb 12 19:41:54 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:  new
           Priority:  normal         |         Milestone:
          Component:  GHCi           |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Other
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 I found the following behavior surprising:
 {{{#!hs
 GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /tmp/ghci7261/ghci-script
 Prelude> class Foo a where { foo :: a -> Int }
 Prelude> instance Foo () where { foo _ = 1 }
 Prelude> f = foo ()
 Prelude> class Foo a where { foo :: a -> IO () }
 Prelude> f
 1
 }}}

 `Foo` is redefined but `f` which uses a now illegal instance of `Foo` is
 still accessible. I would have expected that any bindings that use the old
 `foo` (or have the old `foo` in their call graph) would be cleared.

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


More information about the ghc-tickets mailing list