snaplet-acid-state-0.1: acid-state snaplet for Snap Framework

Snap.Snaplet.AcidState

Synopsis

Documentation

data Acid st Source

Data type holding acid-state snaplet data.

Instances

HasAcid (Acid st) st 

class HasAcid myState acidState whereSource

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)

Methods

getAcidStore :: myState -> Acid acidStateSource

Instances

HasAcid (Acid st) st 

acidInitSource

Arguments

:: (IsAcidic st, Typeable st) 
=> st

Initial state to be used if

-> SnapletInit b (Acid st) 

acidInit'Source

Arguments

:: 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.

update :: (MonadState s m, HasAcid s (MethodState event), UpdateEvent event, MonadIO m) => event -> m (EventResult event)Source

Wrapper for acid-state's update function that works for arbitrary instances of HasAcid.

query :: (HasAcid s (MethodState event), MonadIO m, QueryEvent event, MonadState s m) => event -> m (EventResult event)Source

Wrapper for acid-state's query function that works for arbitrary instances of HasAcid.

module Data.Acid