Unpack primitive types by default in data

Johan Tibell johan.tibell at gmail.com
Fri Feb 17 02:10:23 CET 2012

On Thu, Feb 16, 2012 at 5:03 PM, Alex Mason <axman6 at gmail.com> wrote:
> Of course, that makes sense. Do we already have a way to specify that a field should be lazy? I can imagine programs where we don't want this behaviour, and people would need an escape hatch (or their programs might run slower, or even not terminate). I know we've got lazy patterns with ~, do we have data Foo = Foo ~Int | Bar ~Double

This optimization would only apply for strict fields (otherwise it
would be unsound.) There's already a NOUNPACK pragma in HEAD that lets
you turn the optimization off. I think NOUNPACK was added both to
support this feature and so one could turn off the effect of
`-funbox-strict-fields` selectively.

-- Johan

More information about the Glasgow-haskell-users mailing list