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

Safe HaskellSafe-Inferred

Game.Antisplice.Utils.Counter

Description

Provides a counter monad.

Synopsis

Documentation

newtype CounterT m a Source

A counter monad.

Constructors

Counter 

Fields

runCounterT :: Int -> m (a, Int)
 

Instances

MonadTrans CounterT 
MonadError SplErr m0 => MonadError SplErr (CounterT m0) 
ChannelPrinter Bool m0 => ChannelPrinter Bool (CounterT m0) 
ChannelPrinter Int m0 => ChannelPrinter Int (CounterT m0) 
ChannelPrinter Handle m0 => ChannelPrinter Handle (CounterT m0) 
ChannelPrinter PlayerId m0 => ChannelPrinter PlayerId (CounterT m0) 
(MonadDungeon m0, ChannelPrinter PlayerId m0) => Broadcaster PlayerId (CounterT m0) 
Monad m => Monad (CounterT m) 
Functor m => Functor (CounterT m) 
MonadIO m0 => MonadIO (CounterT m0) 
Monad m => MonadCounter (CounterT m) 
MonadAtoms m0 => MonadAtoms (CounterT m0) 
MonadVocab m0 => MonadVocab (CounterT m0) 
MonadPrinter m0 => MonadPrinter (CounterT m0) 
MonadFinalizer m0 => MonadFinalizer (CounterT m0) 
MonadScanner m0 => MonadScanner (CounterT m0) 
MonadExpand m0 => MonadExpand (CounterT m0) 
ExpanderEnv m0 => ExpanderEnv (CounterT m0) 
MonadRandom m0 => MonadRandom (CounterT m0) 
MonadClock m0 => MonadClock (CounterT m0) 
ExtendedPrinter m0 => ExtendedPrinter (CounterT m0) 
MonadDungeon m0 => MonadDungeon (CounterT m0) 
MonadPlayer m0 => MonadPlayer (CounterT m0) 
MonadObject m0 => MonadObject (CounterT m0) 
MonadRoom m0 => MonadRoom (CounterT m0) 
HistoryEnv m0 => HistoryEnv (CounterT m0) 
MonadSpawn m0 => MonadSpawn (CounterT m0) 

class Monad m => MonadCounter m whereSource

Typeclass for all counter monads.

Methods

countOn :: m IntSource

Tell the current number and increment it

withCounter :: (Monad m, Functor m) => CounterT m a -> m aSource

Run the given function inside a counter