
28 Oct
2008
28 Oct
'08
4:56 p.m.
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?