[Haskell] thread-local variables (was: Re: Implicit Parameters)

Einar Karttunen ekarttun at cs.helsinki.fi
Mon Jul 31 08:18:12 EDT 2006


On 31.07 14:03, Thomas Conway wrote:
> This is why I believe transaction-local variables are a more useful concept.
> You are garanteed that there is only one thread accessing them, and
> they behave just like ordinary TVars except that each transaction has
> its own copy.

This seems like it could be useful. E.g. marking graph nodes while
traversing them.

> The argument to newLVar is an initial value that is used at the start
> of each transaction.  Note that this means that the value in an LVar
> does not persist between transaction. I agree that this limits their
> use, but simplifies them immensely, and doesn't stand in the way their
> being useful for solving a bunch of problems.

I think that them "reverting" to the initial value is more useful
than persisting behavior.

- Einar Karttunen


More information about the Haskell mailing list