vault-0.2.0.4: a persistent store for values of arbitrary types

Safe HaskellNone

Data.Vault.ST

Contents

Synopsis

Synopsis

A persistent store for values of arbitrary types. Variant for the ST monad.

Vault

type Vault = VaultSource

A persistent store for values of arbitrary types.

This variant is the simplest and creates keys in the IO monad. See the module Data.Vault.ST if you want to use it with the ST monad instead.

 type Vault :: * -> *
 instance Monoid Vault

type Key = KeySource

Keys for the vault.

 type Key :: * -> * -> *

empty :: Vault sSource

The empty vault.

newKey :: ST s (Key s a)Source

Create a new key for use with a vault.

lookup :: Key s a -> Vault s -> Maybe aSource

Lookup the value of a key in the vault.

insert :: Key s a -> a -> Vault s -> Vault sSource

Insert a value for a given key. Overwrites any previous value.

adjust :: (a -> a) -> Key s a -> Vault s -> Vault sSource

Adjust the value for a given key if it's present in the vault.

delete :: Key s a -> Vault s -> Vault sSource

Delete a key from the vault.

union :: Vault s -> Vault s -> Vault sSource

Merge two vaults (left-biased).

Locker

type Locker = LockerSource

A persistent store for a single value.

 type Locker :: * -> *

lock :: Key s a -> a -> Locker sSource

Put a single value into a Locker.

unlock :: Key s a -> Locker s -> Maybe aSource

Retrieve the value from the Locker.