chatty-utils-0.6: Some utilities every serious chatty-based application may need.

Safe HaskellNone

Data.Chatty.Atoms

Description

Provides a variable-storing monad and functions for access

Synopsis

Documentation

newtype Atom a Source

Phantom type for atom IDs

Constructors

Atom Int 

Instances

Eq (Atom a) 
Ord (Atom a) 

newtype AtomStoreT m a Source

The storage monad

Constructors

AtomStore 

Fields

runAtomStoreT :: AVL (Int, Dynamic) -> m (a, AVL (Int, Dynamic))
 

class ChCounter m => ChAtoms m whereSource

Typeclass for all atom-storing monads.

Methods

newAtom :: Typeable v => m (Atom v)Source

Reserve a new atom.

putAtom :: Typeable v => Atom v -> v -> m ()Source

Save a value for the given atom.

getAtom :: Typeable v => Atom v -> m vSource

Get the value from a given atom.

dispAtom :: Atom v -> m ()Source

Dispose the given atom.

cloneAtom :: Typeable v => Atom v -> m (Atom v)Source

Clone the given atom.

Instances

newtype (Typeable a, Typeable b) => Atomar m a b Source

Atomar operation (almost arrow)

Constructors

Atomar 

Fields

runAtomar :: Atom a -> m (Atom b)
 

mapAtom :: (Typeable a, Typeable b, ChAtoms m) => (a -> b) -> Atom a -> m (Atom b)Source

Run a pure function on atoms.