Safe Haskell | None |
---|---|
Language | Haskell98 |
- newtype Acid st = Acid {
- _acidStore :: AcidState st
- class HasAcid myState acidState | myState -> acidState where
- getAcidStore :: myState -> Acid acidState
- acidInit :: (IsAcidic st, Typeable st) => st -> SnapletInit b (Acid st)
- acidInit' :: IsAcidic st => FilePath -> st -> SnapletInit b (Acid st)
- acidInitMemory :: IsAcidic st => st -> SnapletInit b (Acid st)
- acidInitManual :: IsAcidic st => AcidState st -> SnapletInit b (Acid st)
- getAcidState :: (HasAcid s st, MonadSnaplet m, MonadState s (m b b)) => m b v (AcidState st)
- update :: (HasAcid s (MethodState event), MonadSnaplet m, MonadState s (m b b), UpdateEvent event, MonadIO (m b v)) => event -> m b v (EventResult event)
- query :: (HasAcid s (MethodState event), MonadSnaplet m, MonadState s (m b b), QueryEvent event, MonadIO (m b v)) => event -> m b v (EventResult event)
- createCheckpoint :: (MonadIO (m b v), MonadSnaplet m, MonadState s (m b b), HasAcid s st) => m b v ()
- createArchive :: (MonadIO (m b v), MonadSnaplet m, MonadState s (m b b), HasAcid s st) => m b v ()
- closeAcidState :: (MonadIO (m b v), MonadSnaplet m, MonadState s (m b b), HasAcid s st) => m b v ()
- initWorker :: IO (AcidState st) -> Initializer b v (Acid st)
- module Data.Acid
Documentation
Data type holding acid-state snaplet data.
Acid | |
|
class HasAcid myState acidState | myState -> acidState where Source
Type class standardizing a context that holds an AcidState.
You can minimize boilerplate in your application by adding an instance like the following:
data App = App { ... _acid :: Snaplet (Acid MyState) ... } instance HasAcid App MyState where getAcidStore = getL (snapletValue . acid)
getAcidStore :: myState -> Acid acidState Source
:: (IsAcidic st, Typeable st) | |
=> st | Initial state to be used if |
-> SnapletInit b (Acid st) |
Initializer that stores the state in the "state/[typeOf state]/" directory.
:: IsAcidic st | |
=> FilePath | Location of the acid-state store on disk |
-> st | Initial state to be used if |
-> SnapletInit b (Acid st) |
Initializer allowing you to specify the location of the acid-state store.
:: IsAcidic st | |
=> st | Initial state to be used if |
-> SnapletInit b (Acid st) |
Initializer allowing you to open an in-memory store (typically for testing)
:: IsAcidic st | |
=> AcidState st | AcidState state to be used |
-> SnapletInit b (Acid st) |
Initializer allowing you to specify the AcidState to use. This AcidState must be initialized manually elsewhere. It will not be automatically closed by the snaplet.
getAcidState :: (HasAcid s st, MonadSnaplet m, MonadState s (m b b)) => m b v (AcidState st) Source
Lower-level function providing direct access to the AcidState data type.
update :: (HasAcid s (MethodState event), MonadSnaplet m, MonadState s (m b b), UpdateEvent event, MonadIO (m b v)) => event -> m b v (EventResult event) Source
Wrapper for acid-state's update function that works for arbitrary instances of HasAcid.
query :: (HasAcid s (MethodState event), MonadSnaplet m, MonadState s (m b b), QueryEvent event, MonadIO (m b v)) => event -> m b v (EventResult event) Source
Wrapper for acid-state's query function that works for arbitrary instances of HasAcid.
createCheckpoint :: (MonadIO (m b v), MonadSnaplet m, MonadState s (m b b), HasAcid s st) => m b v () Source
Wrapper for acid-state's createCheckpoint function that works for arbitrary instances of HasAcid.
createArchive :: (MonadIO (m b v), MonadSnaplet m, MonadState s (m b b), HasAcid s st) => m b v () Source
Wrapper for acid-state's createArchive function that works for arbitrary instances of HasAcid.
closeAcidState :: (MonadIO (m b v), MonadSnaplet m, MonadState s (m b b), HasAcid s st) => m b v () Source
Wrapper for acid-state's closeAcidState function that works for arbitrary instances of HasAcid. The state is automatically closed by the snaplet's unload action, but this is here in case the user needs more control.
initWorker :: IO (AcidState st) -> Initializer b v (Acid st) Source
Core init functionality common to both exported variants.
module Data.Acid