According to this article,
Enumerations don\'t count as single-constructor types as far as GHC is concerned, so they don\'t benefit from unpacking when us
I would guess that GHC has changed quite a bit since that page was last updated in 2008. Also, you're using the LLVM backend, so that's likely to have some effect on performance as well. GHC can (and will, since you've used -O2
) strip any error handling code from f
, because it knows statically that f
is total. The same cannot be said for g
. I would guess that it's the LLVM backend that then unpacks the constructor tags in f
, because it can easily see that there is nothing else used by the branching condition. I'm not sure of that, though.