[Haskell-cafe] Re: Datatypes - Haskell
Don Stewart
dons at galois.com
Mon Feb 11 19:26:38 EST 2008
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
More information about the Haskell-Cafe
mailing list