Bools are not unboxed

John Meacham john at
Tue Oct 5 19:53:18 EDT 2004

On Tue, Oct 05, 2004 at 01:48:30PM +0100, Simon Marlow wrote:
> It would probably be better to return 0#/1# instead of a Bool from the
> comparison primops, because this would expose slightly more detail to
> the simplifier and might result in slightly better code in some cases
> (but no dramatic improvements).  It would also let us remove a bit of
> complexity from the code generator.

This seems like it could be nicely generalized such that all enumeration
types unbox to the unboxed integer of their offset. so

data Perhaps = Yes | Maybe | No

can unbox to an Int# with 0# == Yes 1# == Maybe and 2# == No.

Then we get the Bool optimization for free. 


John Meacham - ⑆⑆john⑈ 

More information about the Glasgow-haskell-users mailing list