Rijk-Jan van Haaften rjchaaft@cs.uu.nl
Tue, 15 Jan 2002 13:06:58 +0100

>| Newtypes are better than datatypes:
>|    If your datatype has a single constructor with a single field,
>| use a newtype declaration instead of a data declaration. The newtype
>| will be optimised away in most cases

This feature is one I consider among the worst in Haskell. If
a datatype with just a single constructor can be optimized away,
why burden the programmer with such a task. It's easy for the
compiler to filter out the data declarations having only one
constructor and optimize them in the newtype way.

I can't see any reasons not to do such data decl. optimization,
but maybe I'm missing some point. Can anyone tell why this is
up to the programmer, rather than the compiler?