Please reply to dfeuer@cs.brown.edu I don't remember if I answered this before, but... I don't see the relevance of there being no constructor to match on. That is the case for any tuple type. It seems that newtype T1 [a1 a2 ...] = C1 ... is the same as data T2 [a1 a2 ...] = C2 !... !... !... Except that pattern matching on C1 is like lazy pattern matching on C2. Since newtype is supposed to be about efficiency, I am trying to understand what makes this more efficient. I have not yet seen any explanation of this. On 22 Jan 2002, Martin [ISO-8859-1] Norb�ck wrote:
tis 2002-01-22 klockan 15.52 skrev Feuer:
Why is pattern matching on newtypes lazy? Does this add to efficiency somehow? If not, it seems to be just another rule to keep straight.
That's the difference between newtype and data. Newtypes are unboxed, so there is no constructor to match on. Pattern matching on newtypes is only a type-checker thing, the constructor doesn't exist.
Regards,
Martin
-- [ http://www.dtek.chalmers.se/~d95mback/ ] [ PGP: 0x453504F1 ] [ UIN: 4439498 ] Opinions expressed above are mine, and not those of my future employees. SIGBORE: Signature boring error, core dumped