[Haskell-cafe] guided seq (Was: Interruptible threads with IO loops)

wren ng thornton wren at freegeek.org
Wed Dec 21 19:04:13 CET 2011


On 12/21/11 4:31 AM, Joachim Breitner wrote:
> This would be particularly handy when with, for example
>          snd tuple `evaluateUntilItDoesNotNeed` tuple
> where the tuple is unevaluated in the right component (and where we
> don’t want to force this just now), but retains something large in the
> left component (that we want to become GCable).

Can't you already do that with:

     let (_,x) = tuple in ...x...

or

     case tuple of (_,x) -> ...x...

?

The tuple will be evaluated far enough that we can access its second 
component, and then we're free to discard the tuple itself provided it's 
not referenced elsewhere. The above would only be strict in x if the use 
sites are strict.

Or do you mean that you want something with the semantics of the above, 
but with a syntactic form that enables us to abstract out the ellipses?

-- 
Live well,
~wren



More information about the Haskell-Cafe mailing list