
6 Oct
2008
6 Oct
'08
3:12 a.m.
dagit:
data and newtype vary in one more subtle way, and that's how/when they evaluate to bottom. Most of the time they behave identically, but in the right cases they act sightly differently. newtype is usually regarded as more efficient than data. This is because the compiler can choose to optimize away the newtype so that it only exists at type check time. I think this is also possible with data in some, but not all, uses.
The compiler *must* optimise away the use. They're sort of 'virtual' data, guaranteed to have no runtime cost. -- Don