Are newtypes faster than enumerations?
问题 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 used as strict constructor fields, or strict function arguments. This is a deficiency in GHC, but it can be worked around. And instead the use of newtypes is recommended. However, I cannot verify this with the following code: {-# LANGUAGE MagicHash,BangPatterns #-} {-# OPTIONS_GHC -O2 -funbox-strict-fields -rtsopts -fllvm -optlc --x86-asm-syntax