[GHC] #7123: Dictionary method should be applicable even in existential context

GHC cvs-ghc at haskell.org
Tue Aug 7 17:31:10 CEST 2012


#7123: Dictionary method should be applicable even in existential context
------------------------------+---------------------------------------------
 Reporter:  heisenbug         |          Owner:                  
     Type:  bug               |         Status:  new             
 Priority:  normal            |      Component:  Compiler        
  Version:  7.4.1             |       Keywords:                  
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
  Failure:  None/Unknown      |       Testcase:                  
Blockedby:                    |       Blocking:                  
  Related:                    |  
------------------------------+---------------------------------------------

Comment(by parcs):

 I don't think this is a bug. This is related to associated type families
 not being injective. For instance, imagine this instance of `Foo` was
 introduced (alongside the existing `Int` instance):

 {{{
 instance Foo Char where
     type Bar Char = (Int,Int)
     baz (_,i) = i
 }}}

 Now, when calling `baz b`, it's not clear which instance should get
 selected, because `b` can be either a `Bar Char` or `Bar Int` at that
 point.

 If you replace `Bar` with an associated data family (which are injective),
 your example will typecheck.

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



More information about the Glasgow-haskell-bugs mailing list