Data.Vault

vault-0.1.0.0: a typed, persistent store for values of arbitrary types

Safe Haskell | None

Data.Vault

Synopsis

- type Vault = Vault RealWorld
- type Key = Key RealWorld
- empty :: Vault
- newKey :: IO (Key a)
- lookup :: Key a -> Vault -> Maybe a
- insert :: Key a -> a -> Vault -> Vault
- adjust :: (a -> a) -> Key a -> Vault -> Vault
- delete :: Key a -> Vault -> Vault
- union :: Vault -> Vault -> Vault

# Documentation

type Vault = Vault RealWorld

A typed, 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.

     instance Monoid Vault

type Key = Key RealWorld

Keys for the vault.

     Key :: * -> *

empty :: Vault

The empty vault.

newKey :: IO (Key a)

Create a new key for use with a vault.

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

Lookup the value of a key in the vault.

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

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

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

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

delete :: Key a -> Vault -> Vault

Delete a key from the vault.

union :: Vault -> Vault -> Vault

Merge two vaults (left-biased).