[Haskell-cafe] When does the UNPACK pragma work?
Eugene Kirpichov
ekirpichov at gmail.com
Fri Oct 28 11:57:54 CEST 2011
Another question: Can I unpack some fields in a record and not unpack
others? Does their order matter then?
On Fri, Oct 28, 2011 at 1:57 PM, Eugene Kirpichov <ekirpichov at gmail.com>wrote:
> Oh, I see, thanks!
>
> So then, I guess, the solution would be to use a fixed-precision integer
> type instead.
>
>
> On Fri, Oct 28, 2011 at 1:54 PM, Daniel Fischer <
> daniel.is.fischer at googlemail.com> wrote:
>
>> 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.
>>
>
>
>
> --
> Eugene Kirpichov
> Principal Engineer, Mirantis Inc. http://www.mirantis.com/
> Editor, http://fprog.ru/
>
--
Eugene Kirpichov
Principal Engineer, Mirantis Inc. http://www.mirantis.com/
Editor, http://fprog.ru/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111028/1dde8c8c/attachment.htm>
More information about the Haskell-Cafe
mailing list