Unpack primitive types by default in data

Alex Mason axman6 at gmail.com
Fri Feb 17 02:03:24 CET 2012


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

Alex

On 17/02/2012, at 11:59, Johan Tibell wrote:

> On Thu, Feb 16, 2012 at 4:52 PM, Alex Mason <axman6 at gmail.com> wrote:
>> Sounds like it's definitely worth playing with. I would hesitate to use the shootout benchmarks though, simply because anything there is already going to be unpacked to the hilt.
> 
> That was the point of number (2) above. By disabling their unpack
> pragmas through the compiler and measuring the performance, we can
> simulate a world where people don't write unpack pragmas and then see
> how much GHC could improve things in such a world. If the gain is
> large enough we can turn this optimization on and people can waste
> less time cluttering their code with unpack pragmas!
> 
> Note that this proposal doesn't but you any new expressive powers. The
> intention is two-fold: decrease the amount of clutter in Haskell
> programs and have code written by beginner/intermediate level
> Haskellers perform better out-of-the-box.
> 
>> How difficult do you think it would be to implement this in GHC?
> 
> Quite easy I think. All the difficulty is in getting good benchmarks.
> 
> -- Johan




More information about the Glasgow-haskell-users mailing list