#1897: Ambiguous types and rejected  type signatures
----------------------------------------+-----------------------------------
    Reporter:  guest                    |        Owner:  chak       
        Type:  bug                      |       Status:  reopened   
    Priority:  normal                   |    Milestone:  6.12 branch
   Component:  Compiler (Type checker)  |      Version:  6.9        
    Severity:  normal                   |   Resolution:             
    Keywords:                           |   Difficulty:  Unknown    
    Testcase:                           |           Os:  Linux      
Architecture:  x86                      |  
----------------------------------------+-----------------------------------
Comment (by simonpj):

 Yet another (killer) type-family example:
 {{{
 class Key k where
   type Map k :: * -> *
   empty :: Map k v

 instance Key a => Key (Maybe a) where
   type Map (Maybe a) = MM a
   empty = MM Nothing empty

 data MM a v = MM (Maybe v) (Map a v)
 }}}
 where we get
 {{{
 Map.hs:27:21:
     Couldn't match expected type `Map a' against inferred type `Map k'
     In the second argument of `MM', namely `empty'
     In the expression: MM Nothing empty
     In the definition of `empty': empty = MM Nothing empty
 }}}
 The terrible thing is that no amount of type signatures will fix this!

 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1897#comment:16>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to