acid-state-0.6.3: Add ACID guarantees to any serializable Haskell data structure.

Portabilitynon-portable (uses GHC extensions)
Maintainerlemmih@gmail.com
Safe HaskellNone

Data.Acid.Common

Description

Common structures used by the various backends (local, memory).

Synopsis

Documentation

class SafeCopy st => IsAcidic st whereSource

Methods

acidEventsSource

Arguments

:: [Event st]

List of events capable of updating or querying the state.

newtype Update st a Source

Context monad for Update events.

Constructors

Update 

Fields

unUpdate :: State st a
 

Instances

newtype Query st a Source

Context monad for Query events.

Constructors

Query 

Fields

unQuery :: Reader st a
 

Instances

runQuery :: Query st a -> Update st aSource

Run a query in the Update Monad.

type EventResult ev = MethodResult evSource

Events return the same thing as Methods. The exact type of EventResult depends on the event.

data Event st whereSource

We distinguish between events that modify the state and those that do not.

UpdateEvents are executed in a MonadState context and have to be serialized to disk before they are considered durable.

QueryEvents are executed in a MonadReader context and obviously do not have to be serialized to disk.

Constructors

UpdateEvent :: UpdateEvent ev => (ev -> Update (EventState ev) (EventResult ev)) -> Event (EventState ev) 
QueryEvent :: QueryEvent ev => (ev -> Query (EventState ev) (EventResult ev)) -> Event (EventState ev) 

class Method ev => UpdateEvent ev Source

All UpdateEvents are also Methods.

class Method ev => QueryEvent ev Source

All QueryEvents are also Methods.