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

Safe HaskellNone
LanguageHaskell98

Data.Vault.ST.Strict

Contents

Description

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

The Vault type in this module is strict in both keys and values.

Synopsis

Vault

data Vault s Source #

Instances

Semigroup (Vault s) # 

Methods

(<>) :: Vault s -> Vault s -> Vault s #

sconcat :: NonEmpty (Vault s) -> Vault s #

stimes :: Integral b => b -> Vault s -> Vault s #

Monoid (Vault s) # 

Methods

mempty :: Vault s #

mappend :: Vault s -> Vault s -> Vault s #

mconcat :: [Vault s] -> Vault s #

data Key s a Source #

empty :: Vault s Source #

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 a Source #

Lookup the value of a key in the vault.

insert :: Key s a -> a -> Vault s -> Vault s Source #

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

adjust :: (a -> a) -> Key s a -> Vault s -> Vault s Source #

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

delete :: Key s a -> Vault s -> Vault s Source #

Delete a key from the vault.

union :: Vault s -> Vault s -> Vault s Source #

Merge two vaults (left-biased).

Locker

data Locker s Source #

lock :: Key s a -> a -> Locker s Source #

Put a single value into a Locker.

unlock :: Key s a -> Locker s -> Maybe a Source #

Retrieve the value from the Locker.