concurrent-supply-0.1.2: A fast concurrent unique identifier supply with a pure API

Portabilityportable
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellNone

Control.Concurrent.Supply

Contents

Description

A globally unique fresh identifier supply with local pooling and replay support.

Synopsis

Documentation

data Supply Source

A user managed globally unique variable supply.

Variables

newSupply :: IO SupplySource

Grab a new supply. Any two supplies obtained with newSupply are guaranteed to return disjoint sets of identifiers. Replaying the same sequence of operations on the same Supply will yield the same results.

freshId :: Supply -> (Int, Supply)Source

Obtain a fresh Id from a Supply.

splitSupply :: Supply -> (Supply, Supply)Source

Split a supply into two supplies that will return disjoint identifiers

Unboxed API

freshId# :: Supply -> (#Int#, Supply#)Source

An unboxed version of freshId

splitSupply# :: Supply -> (#Supply, Supply#)Source

An unboxed version of splitSupply