HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulepolysemy-1.9.2.0Haskell2010

Polysemy.AtomicState

  • 1 type
  • 14 values
  • Packagepolysemy-1.9.2.0
  • Exports15
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceAtomicState.hs

Effect

1 declaration

Actions

7 declarations

Interpretations

7 declarations
valueatomicStateToIO
  1. :: Member (Embed IO) r
  2. => s
  3. -> Sem (AtomicState s ': r) a
  4. -> Sem r (s, a)
#

Run an AtomicState effect in terms of atomic operations in IO.

Internally, this simply creates a new IORef, passes it to runAtomicStateIORef, and then returns the result and the final value of the IORef.

Beware: As this uses an IORef internally, all other effects will have local state semantics in regards to AtomicState effects interpreted this way. For example, throw and catch will never revert atomicModifys, even if runError is used after atomicStateToIO.