monad-atom-0.2.0: Monadically convert objects to unique atoms and back.

Control.Monad.Atom

Synopsis

Documentation

class Monad m => MonadAtom m whereSource

Methods

toAtom :: Binary a => a -> m IntSource

Monadically convert the argument into an atom (represented as an Int)

maybeToAtom :: Binary a => a -> m (Maybe Int)Source

Monadically convert the argument into an atom, but only if the corresponding atom has already been created

fromAtom :: Binary a => Int -> m aSource

Monadically convert an atom represented as an Int to its corresponding object

Instances

data AtomT m r Source

Instances

evalAtomT :: Monad m => AtomT m a -> m aSource

runAtomT :: AtomT t t1 -> AtomTable -> t (t1, AtomTable)Source

atoms :: AtomTable -> [Int]Source

The list of atoms (as Ints) stored in the atom table