[GHC] #9288: Type class overlapping instances check doesn't understand type equality

GHC ghc-devs at haskell.org
Tue Jul 15 16:40:05 UTC 2014


#9288: Type class overlapping instances check doesn't understand type equality
-------------------------------------+-------------------------------------
              Reporter:  ezyang      |             Owner:
                  Type:  bug         |            Status:  closed
              Priority:  low         |         Milestone:
             Component:  Compiler    |           Version:  7.9
  (Type checker)                     |          Keywords:
            Resolution:  invalid     |  Operating System:  Unknown/Multiple
Differential Revisions:              |   Type of failure:  GHC accepts
          Architecture:              |  invalid program
  Unknown/Multiple                   |         Test Case:
            Difficulty:  Unknown     |          Blocking:
            Blocked By:              |
       Related Tickets:              |
-------------------------------------+-------------------------------------
Changes (by simonpj):

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


Comment:

 This is by design. GHC does not report overlapping instances eagerly (at
 the instance definition site).  Rather it reports them lazily (when used).
 There is good reason for this:
 {{{
 instance C Int a where
 instance C b Bool where
 }}}
 If we reported errors eagerly we'd have to say they overlap.  But there is
 no problem with, say
 `(C Int Char)`.

 It's nothing to do with equalities.

 The user manual does not say this explicitly, so I'll fix that.  Thanks
 for raising it.

 Simon

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


More information about the ghc-tickets mailing list