antisplice-0.11.0.4: An engine for text-based dungeons.

Safe HaskellNone

Game.Antisplice.Utils.Atoms

Description

Provides a variable-storing monad and functions for access (they almost form an arrow)

Synopsis

Documentation

newtype Atom a Source

Phantom type for atom IDs

Constructors

Atom Int 

Instances

Eq (Atom a) 
Ord (Atom a) 

class MonadCounter m => MonadAtoms 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.

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, MonadAtoms m) => (a -> b) -> Atom a -> m (Atom b)Source

Run a pure function on atoms.