Strict tuples

Simon Marlow simonmar at microsoft.com
Thu Mar 23 08:55:44 EST 2006


On 23 March 2006 02:24, Ben Rudiak-Gould wrote:

> Bulat Ziganshin wrote:
>> Taral wrote:
>>> I don't see that more optimization follows from the availability
>>> of information regarding the strictness of a function result's
>>> subcomponents.
>> 
>> 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
> 
> Mmm, not quite. Unboxed tuples are boxed tuples restricted such that
> they never have to be stored on the heap, but this has no effect on
> semantics at all. A function returning (# Double,Double #) may still
> return two thunks. 

Yes, this is why the unboxed 1-tuple makes sense :-)

   indexArray# :: Array# a -> Int# -> (# a #)

Cheers,
	Simon


More information about the Haskell-prime mailing list