
3 Dec
2009
3 Dec
'09
2:40 a.m.
2009/12/3 Gregory Crosswhite
But it seems to me like the whole point of using "newtype" is because you *don't* want your new type to be used everywhere that the old type can be used; otherwise you would just use "type" to create an alias. The only convincing exception I have heard to this (as you helpfully explained to me) is that one might be forced to use newtype to make a piece of code use a different instance declaration for a type.
You might also be forced to use a newtype because you need to use it recursively - i.e. you need an alternative to equirecursive types. I hit this quite often when building datatype using fixpoints-of-a-functor and regularly wish for the ability to write: type Fix f = f (Fix f) Cheers, Max