
On Mon, 2007-02-05 at 19:26 -0800, Stefan O'Rear wrote:
I have a structure:
data Attr = Attr { fg :: !Color, bg :: !Color, bold :: !Bool, blink :: !Bool, rv :: !Bool, halfBright :: !Bool, underline :: !Bool } deriving(Eq,Show,Ord)
newtype Color = Color Int deriving(Eq,Show,Ord)
(Also, GHC seems unable to unbox strict fields that are newtypes. Can this be done, or should I abandon type safety and use type synonyms?)
You have to tell GHC that you want fields to be unboxed (this is because it's not always an optimisation). You can either do it for all strict fields in the whole module by using the -funbox-strict-fields flag, or on a per field basis with: data Attr = Attr { fg :: {-# UNPACK #-} !Color, bg :: {-# UNPACK #-} !Color, ... Duncan