
On Thu, Aug 09, 2007 at 11:09:36PM -0400, ajb@spamcop.net wrote:
Quoting Stefan O'Rear
: In general, GHC doesn't do "unboxing". Instead it has a simpler and more general approach, [...]
I'm not convinced that the phrase "more general" is appropriate here. :-)
Not sure where that came from; my filters are usually better than that :)
As far as actual heap usage goes, GHC creates single static values for all 0-argument constructors; so all Bool WHNFs are one of two addresses, one for True and one for False.
And, of course, if it's a strict argument, then the values stored are ALWAYS one of two possibilities. So as a matter of curiosity, would there be any advantage at all for "unboxing" enumeration types? (Apart from, I suppose, the possibility of using fewer than 32/64 bits to store a flag.)
That was actually described in the first paper on first-class unboxed types. The paper described a general mechanism for declaring user-defined unboxed types and procedures for unboxing any ADT. No idea if it was ever implemented, though. Stefan