[Haskell-cafe] known, I know: class contexts and mutual recursion

Conor McBride ctm at cs.nott.ac.uk
Mon Dec 4 13:26:31 EST 2006


Hi

Iavor Diatchki wrote:
> Hello,
>
>> I just tripped over the "Contexts differ in length" error message. I
>> know it's not a new problem, but I thought I'd enquire as to its status.
>
> I have run into that a number of times.  There aren't any technical
> issues with solving it, in fact, depending on how one implements the
> type checker, it is more work to implement this extra restriction

Yes, that's what I would expect. It's an inevitable but not threatening 
consequence of polymorphic recursion. It rather surprised me that just 
telling the machine what my plan was (something I always do anyway) 
produced such an objection.

> It is proposed for fixing in Haskell' but I was surprised that it did
> not seem to appear on the "definitely in" list (as far as I can
> recall---I might be wrong).

 From what I can tell, it's "probably in". Strikes me as fairly 
essential. I don't expect artificial restrictions to be placed on the 
types of my programs when I am willing to make those types explicit.

>   Hopefully the report will be fixed
> though.  Otherwise, as Ian mentioned, it works in GHC 6.6 with
> -fglasgow-exts.  Also, there should be no problems with higher-ranked
> types etc.

Thanks for the tip, Ian. I guess I shouldn't put off installing 6.6 any 
longer.

All the best

Conor



More information about the Haskell-Cafe mailing list