Hi,

I'm trying to speed up Data.Time (the time package) 'cause my program is spending a very substantial fraction of time manipulating dates.

I decided to start with strictifying and unpacking the date/time types, as there's no point in having them be lazy and I indeed had a lot of allocation in date/time arithmetic in my performance profile.

data UTCTime = UTCTime {
    utctDay :: {-# UNPACK #-} !Day,
    utctDayTime :: {-# UNPACK #-} !DiffTime
}

(unpacks and strictness mine)

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?

Data\Time\Clock\UTC.hs:30:16:
    Warning: Ignoring unusable UNPACK pragma on the
             first argument of `UTCTime'
    In the definition of data constructor `UTCTime'
    In the data type declaration for `UTCTime'

Data\Time\Clock\UTC.hs:30:16:
    Warning: Ignoring unusable UNPACK pragma on the
             second argument of `UTCTime'
    In the definition of data constructor `UTCTime'
    In the data type declaration for `UTCTime'



--
Eugene Kirpichov
Principal Engineer, Mirantis Inc. http://www.mirantis.com/
Editor, http://fprog.ru/