Proposal: Add newUniqueSTM to Data.Unique

Edward Kmett ekmett at
Wed Jan 19 23:18:06 CET 2011

On Wed, Jan 19, 2011 at 4:44 PM, Bas van Dijk <v.dijk.bas at> wrote:

> Does newUniqueSTM give you a performance advantage in a STM transaction? Or
> is it just a convenience that you don't need to use unsafeIOToSTM?

It is more than a convenience, because I can't actually use unsafeIOToSTM on
any IO action that internally uses atomically. Nesting 'atomically' results
in the runtime system shutting down, because it has no way to backtrack and
retry STM computations when they are nested. This is a consequence rather
all out of proportion to the act of asking for a fresh identifier. ;)

Because of the slightly simpler implementation and slightly
> better performance I'm for reverting to IORefs.

Switching back to IORefs would be my preferred solution as well.

-Edward Kmett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list