polysemy-conc-0.4.0.1: lib/Polysemy/Conc/AtomicState.hs
-- |Description: AtomicState Interpreters
module Polysemy.Conc.AtomicState where
import Polysemy.AtomicState (runAtomicStateTVar)
-- |Convenience wrapper around 'runAtomicStateTVar' that creates a new 'TVar'.
interpretAtomic ::
∀ a r .
Member (Embed IO) r =>
a ->
InterpreterFor (AtomicState a) r
interpretAtomic initial sem = do
tv <- newTVarIO initial
runAtomicStateTVar tv sem
{-# inline interpretAtomic #-}