
Andrew Coppin schrieb:
I've always thought of compiler flags as being a fairly imprecise tool. For example, -funbox-strict-fields applies a particular transformation to EVERY STRICT FIELD IN THE ENTIRE PROGRAM. Which is fine if it's always a win - but then, if it were always a win, there wouldn't be a flag to turn it on. It would just be on permanently. ;-) I've always thought it's much better to write source annotations on the specific fields you want unboxed. You have more control this way. (And you don't have to remember any special compiler flags.) I'm talking about unboxing of course, but the same deal applies to inlining or any number of other source-level transformations that GHC can perform.
http://hackage.haskell.org/packages/archive/bytestring/0.9.1.7/doc/html/src/... data ByteString = PS {-# UNPACK #-} !(ForeignPtr Word8) -- payload {-# UNPACK #-} !Int -- offset {-# UNPACK #-} !Int -- length