[Haskell-cafe] When does the UNPACK pragma work?

Daniel Fischer daniel.is.fischer at googlemail.com
Fri Oct 28 11:54:40 CEST 2011


On Friday 28 October 2011, 11:41:15, Eugene Kirpichov wrote:
> newtype Day = ModifiedJulianDay {toModifiedJulianDay :: Integer}
> newtype DiffTime = MkDiffTime Pico
> 
> And Pico is also essentially a newtype for Integer.
> 
> So, I'm getting warnings on this definition of UTCTime.
> QUESTION: Is it the case that I can only UNPACK primitive fields, and
> not even their newtypes?

The problem is that you can't {-# UNPACK #-} Integer.
You can only unpack single-constructor types.



More information about the Haskell-Cafe mailing list