stm-supply-0.1.0.0: STM wrapper around Control.Concurrent.Supply.

Safe HaskellNone
LanguageHaskell2010

Control.Concurrent.STMSupply

Synopsis

Documentation

data STMSupply Source #

newtype wrapper around a TVar Supply.

newSTMSupplyIO :: IO STMSupply Source #

Construct a new STMSupply in the IO Monad.

freshId :: STMSupply -> STM Int Source #

Using an STMSupply, atomically get a fresh ID.

splitSupply :: STMSupply -> STM STMSupply Source #

Using an STMSupply, atomically split the underlying Supply into two. Stores one of the new supplies in the STMSupply that was the first argument, and returns the second Supply.