
05 Oct 2001 11:53:05 -0700, Carl R. Witty
Data> (T2 undefined) `seq` () *** Exception: Prelude.undefined Data> (T3 undefined) `seq` () *** Exception: Prelude.undefined
I can't think of a semantic difference between newtype and data with a single unary strict constructor;
It could indeed be represented in the same way, but they behave differently in pattern matching: case undefined of T _ -> () is () in the case of newtype and undefined in the case of strict data. -- __("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ SYGNATURA ZASTÊPCZA QRCZAK

On 5 Oct 2001, Marcin 'Qrczak' Kowalczyk wrote: (snip)
It could indeed be represented in the same way, but they behave differently in pattern matching: case undefined of T _ -> () is () in the case of newtype and undefined in the case of strict data.
Ah. I don't really use "error" or anything in code that may not need to be evaluated, which is why I didn't think of (or care (-:) about that! I'm assuming that other people do! It's like Lisp, I guess - I rarely used eval, but everyone else seemed to. -- Mark
participants (2)
-
Marcin 'Qrczak' Kowalczyk
-
Mark Carroll