newtype | data
Marcin 'Qrczak' Kowalczyk
qrczak@knm.org.pl
5 Oct 2001 19:20:49 GMT
05 Oct 2001 11:53:05 -0700, Carl R. Witty <cwitty@newtonlabs.com> pisze:
> 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