[Haskell-cafe] OOP'er with (hopefully) trivial questions.....

Evan Laforge qdunkan at gmail.com
Mon Dec 17 13:26:53 EST 2007

> I'm sure there's a trivial explanation for this, but here's something
> that I've always kind of wondered about:  Given a single constructor
> type like "data X = X A B C" can't that be transformed into "newtype X
> = X (A, B, C)"?  There must be some difference, because if there
> weren't we could transform all single constructor types that way, and
> dispense with newtype entirely.

Oops, nevermind, I just saw the other thread and link to
http://www.haskell.org/haskellwiki/Newtype.  Ok, so that seems like a
pretty subtle diffenence... I'm assuming the rationale behind
differentiating between a single constructor data and newtype is so
that data types don't suddenly change their behaviour around undefined
when they have only one constructor.  I would find example y3
surprising if I came across it in real code!

More information about the Haskell-Cafe mailing list