
17 Dec
2007
17 Dec
'07
6:59 a.m.
On Dec 17, 2007 10:47 PM, Nicholls, Mark
"The constructor of a newtype must have exactly one field but `R' has two In the newtype declaration for `Rectangle'"
It doesn't like
"newtype Rectangle = R Int Int"
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 Stuart