[GHC] #7102: Type family instance overlap accepted in ghci

GHC ghc-devs at haskell.org
Thu Aug 6 12:45:19 UTC 2015


#7102: Type family instance overlap accepted in ghci
-------------------------------------+-------------------------------------
        Reporter:  exbb2             |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  GHCi              |                 Version:  7.4.1
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  GHC accepts       |  Unknown/Multiple
  invalid program                    |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by simonpj):

 That is indeed very very bad.  Never mind Safe Haskell -- it's just
 unsound. You didn't get a seg fault, but you very well might have.  (For
 class instances it wouldn't be unsound, just possibly a bit incoherent.)

 I'm not sure what to do:
  1. Prohibit `type instance` declarations in GHCi that overlap/override
 earlier ones?

  2. Do (1) but also provide a way to purge the GHCi environment, so you
 can get back to a clean slate without restarting GHCi

  3. Try to be clever: purge only functions (or whatever) whose types
 mention `T`.  But it's tricky: what about data types mentioning `T`, and
 functions whose types use those data types...

 I incline to (2).  Any other opinions?

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


More information about the ghc-tickets mailing list