HORIZON HASKELLDocslts/ghc-10.0.x8c2f8e82026-10-19Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8c2f8e8 · 2026-10-19

Moduleacid-state-0.16.1.4Haskell2010

Data.Acid.Core

Low-level controls for transaction-based state changes. This module defines structures and tools for running state modifiers indexed either by an Method or a serialized Method. This module should rarely be used directly although the Method class is needed when defining events manually.

The term 'Event' is loosely used for transactions with ACID guarantees. 'Method' is loosely used for state operations without ACID guarantees

  • 6 types
  • 1 class
  • 19 values
  • Packageacid-state-0.16.1.4
  • Exports26
  • LanguageHaskell2010
  • LicenceLicenseRef-PublicDomain
  • SourceCore.hs
datadata Core st
#

The control structure at the very center of acid-state. This module provides access to a mutable state through methods. No efforts towards durability, checkpointing or sharding happens at this level. Important things to keep in mind in this module: * We don't distinguish between updates and queries. * We allow direct access to the core state as well as through events.

classclass Method ev where
#

The basic Method class. Each Method has an indexed result type and a unique tag.

Associated types

Methods

valuemkCore
  1. :: [MethodContainer st]

    List of methods capable of modifying the state.

  2. -> st

    Initial state value.

  3. -> IO (Core st)
#

Construct a new Core using an initial state and a list of Methods.

valuecloseCore :: Core st -> IO ()
#

Mark Core as closed. Any subsequent use will throw an exception.

valuecloseCore' :: Core st -> (st -> IO ()) -> IO ()
#

Access the state and then mark the Core as closed. Any subsequent use will throw an exception.

valuemodifyCoreState :: Core st -> (st -> IO (st, a)) -> IO a
#

Modify the state component. The resulting state is ensured to be in WHNF.

valuemodifyCoreState_ :: Core st -> (st -> IO st) -> IO ()
#

Modify the state component. The resulting state is ensured to be in WHNF.

Execute a method as given by a type identifier and an encoded string. The exact format of the encoded string depends on the type identifier. Results are encoded and type tagged before they're handed back out. This function is used when running events from a log-file or from another server. Events that originate locally are most likely executed with the faster runHotMethod.