Polymorphic Recursion / Rank-2 Confusion

Brandon Michael Moore brandon at its.caltech.edu
Sat Sep 20 16:19:10 EDT 2003


Sorry about the empty message. Send /= Cancel

> Can anyone tell me why the following doesn't work (and what I have to do to
> fix it)? I thought by specifying the type of coalw as rank-2 would allow it
> to be used both at a and (a,b).

Frank explained why the type you gave wouldn't work. I would like to add
that your function would type check without the type signature. This
suggests something here is actively confusing. Do you have any idea what
caused this problem?

I hope to help teach Haskell to first year students, so I'm trying to
figure out what parts of the language are hard to get, and how to usefull
explain things. Anything in pure H98 that trips up an experienced
programmer is worth some attention.

Completely unrelated, I think Zero and One would be better names than Even
and Odd because then the string of constructors writes the size of the
vector in binary, LSB first. I can't see any mnenomic value to Even and
Odd. How do you interpret Even and Odd?

Thanks

Brandon



More information about the Haskell mailing list