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

Safe HaskellSafe-Infered

Data.Vault

Contents

Synopsis

Synopsis

A persistent store for values of arbitrary types.

Vault

type Vault = Vault RealWorldSource

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 = Key RealWorldSource

Keys for the vault.

 type Key :: * -> *

empty :: VaultSource

The empty vault.

newKey :: IO (Key a)Source

Create a new key for use with a vault.

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

Lookup the value of a key in the vault.

insert :: Key a -> a -> Vault -> VaultSource

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

adjust :: (a -> a) -> Key a -> Vault -> VaultSource

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

delete :: Key a -> Vault -> VaultSource

Delete a key from the vault.

union :: Vault -> Vault -> VaultSource

Merge two vaults (left-biased).

Locker

type Locker = Locker RealWorldSource

A persistent store for a single value.

 type Locker :: *

lock :: Key a -> a -> LockerSource

Put a single value into a Locker.

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

Retrieve the value from the Locker.