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

GHC ghc-devs at haskell.org
Wed Jul 9 15:40:57 UTC 2014


#9288: Type class overlapping instances check doesn't understand type equality
-------------------------------------+-------------------------------------
       Reporter:  ezyang             |             Owner:
           Type:  bug                |            Status:  new
       Priority:  low                |         Milestone:
      Component:  Compiler (Type     |           Version:  7.9
  checker)                           |  Operating System:  Unknown/Multiple
       Keywords:                     |   Type of failure:  GHC accepts
   Architecture:  Unknown/Multiple   |  invalid program
     Difficulty:  Unknown            |         Test Case:
     Blocked By:                     |          Blocking:
Related Tickets:                     |
-------------------------------------+-------------------------------------
 Here is a sample program which we'd expect to give an overlapping
 instances error, but does not:

 {{{
 {-# LANGUAGE TypeFamilies, FlexibleInstances #-}
 module Foo where
 type family F a :: *
 type instance F Bool = Int
 type instance F Int = Bool
 class C a where
 instance (F Bool ~ a) => C a where
 instance C Int where
 }}}

 Fortunately, GHC does notice when you actually try to use the instance.

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


More information about the ghc-tickets mailing list