[Haskell-cafe] Support of multi-constructor types by UNPACK pragma

Carter Schonwald carter.schonwald at gmail.com
Sun Jun 15 20:30:40 UTC 2014


Are you sure that's not supported? That seems like a bug if so.  I'm away
from my computer right now so I can't check.

What ghc version? How are you checking if the unpack is firing?

Ghc 7.8 should by default be unpacking ALL strict small fields.

On Sunday, June 15, 2014, Nikita Volkov <nikita.y.volkov at mail.ru> wrote:

> Currently the pragma only supports single-constructor types. So in the
> following example it will simply be ignored:
>
> data A =
>   A1 Char |
>   A2 {-# UNPACK #-} !B
>
> data B =
>   B1 Int |
>   B2 Bool
>
> However it seems to be easily solvable by changing the type A to
> something like the following during unpacking:
>
> data A =
>   A1 Char |
>   A2_1 Int |    -- from B1
>   A2_2 Bool     -- from B2
>
> Am I missing something? Why is it not implemented?
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140615/1eac86fd/attachment.html>


More information about the Haskell-Cafe mailing list