> A newtype can only have one constructor, with one argument, and is
> essentially a wrapper for that argument type.
>
> In the general case, you want to use "data" instead of "newtype":
>
>   data Rectangle = R Int Int

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.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to