Strict tuples

Manuel M T Chakravarty chak at
Wed Mar 22 22:32:12 EST 2006

> On 3/22/06, Bulat Ziganshin <bulat.ziganshin at> wrote:
> > ghc uses unboxed tuples just for such sort of optimizations. instead
> > of returning possibly-unevaluated pair with possibly-unevaluated
> > elements it just return, say, two doubles in registers - a huge win
> I have no doubt of this. My comment refers to the idea that somehow
> such strictness annotations are (a) required at the type level and (b)
> required at all to enable such optimization. I believe the
> optimization happens without any annotation from the user, and it
> should stay that way.

It does happen...sometimes!  The trouble is that for certain types of
programs (eg, numeric intensive ones), you absolutely need that
optimisation to happen.  Without strict tuples, this means, you have to
dump the intermediate code of the compiler and inspect it by hand to see
whether the optimisation happens.  If not, you have to tweak the source
to nudge the compiler into recognising that it can optimise.  Of course,
all your efforts may be wasted when the next version of the compiler is
released or when you have to change your code.


More information about the Haskell-prime mailing list