
11 Feb
2008
11 Feb
'08
7:26 p.m.
ok:
On the subject of data types, I've recently seen Haskell code using data Foo ... = Foo { ... } where I would have used newtype instead of data. When is it a good idea to avoid newtype?
It depends what's in the ... If its just something with the same representation as an existing type, using a newtype makes sense. If it builds a more complicated single-contructor type, such as many record types, then data is required. -- Don