"The signature contexts in a mutually recursive group should all be identical"; why?

Simon Peyton-Jones simonpj at microsoft.com
Thu Dec 20 05:21:35 EST 2001


It's what H98 says.  And it's jolly awkward to compile otherwise.
Where does 'f' get the dictionary from to pass to 'g'?  
(Presumably they are mutually recursive.)

Mind you, if you are doing polymorphic recursion then I suppose
these strictures do not apply; but I'll have to fiddle with the type
checker to make that happen (a long-standing wish-list item).
Is it inconvenient, or actually a show stopper?

Simon

| -----Original Message-----
| From: George Russell [mailto:ger at tzi.de] 
| Sent: 19 December 2001 12:22
| To: glasgow-haskell-bugs at haskell.org
| Subject: "The signature contexts in a mutually recursive 
| group should all be identical"; why?
| 
| 
| The attached file doesn't compile (ghc -fglasgow-exts), with 
| the message
| 
| RecContext.hs:12:
|     Mismatched contexts
|     When matching the contexts of the signatures for
|       g :: forall a b. (Silly a b) => a -> b -> SillyType a 
| -> [String]
|       f :: forall a. SillyType a -> [String]
|     The signature contexts in a mutually recursive group 
| should all be identical
|     When generalising the type(s) for g, f
| 
| 
| This seems strange.  f can't have the context Silly a b, as b 
| doesn't occur in its signature and is introduced later as 
| part of an existential constructor . . .
| 
| I know this code looks pretty pointless.  If you want to see 
| the Real World 450 line module which provoked the message, do 
| ask, but only if you like having your brain curdled by 
| mixtures of dependent types, existential types and 
| overlapping multi-parameter type classes . . .
| 




More information about the Glasgow-haskell-bugs mailing list