On Thu, Feb 14, 2008 at 8:01 PM, Samuel Bronson
On 2/14/08, Lemmih
wrote: I mean something like: data Id = Phantom | Unnamed Int | Named Atom Giving special meaning to numbers seems like a hack. Optimizations should not come at the sacrifice of readability.
It's not a hack if you use a newtype... at least, not observably. Yhc didn't, and it did do some really nasty stuff. (Possibly nhc predated newtypes?)
If you hide the implementation then you might as well provide the user with an ADT instead of an Int. The optimizations in Jhc seems to be geared towards making things more "basic". Data types are unrolled so they can fit in an integer, Haskell code is replaced by C code. These optimizations give the illusion of improvements at the cost of readability. Rewriting a piece of Haskell code in C is rather silly when it is the algorithm that's broken. -- Cheers, Lemmih