[Haskell-cafe] computational overhead of the "data" declarations
Eli Ford
eford at griptonite.com
Tue Oct 28 16:56:08 EDT 2008
> So, to answer your question, the only computational overhead with a
> data declaration is the extra memory and time to store and process the
> constructor tags. It usually isn't noticeable, but sometimes the
> difference can be important.
Is there also potentially overhead due to laziness? I mean, in this
case:
newtype Fast = Fast Int
If you have a Fast value, you know you've got a real Int, not a thunk,
right? But here:
data Slow = Slow Int
Doesn't a Slow value remain unevaluated until you pattern match out the
Int?
More information about the Haskell-Cafe
mailing list