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

Safe HaskellSafe
LanguageHaskell2010

Data.Chatty.Counter

Description

Provides a counter monad.

Synopsis

Documentation

newtype CounterT m a Source

A counter monad.

Constructors

Counter 

Fields

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

class Monad m => ChCounter m where Source

Typeclass for all counter monads.

Methods

countOn :: m Int Source

Tell the current number and increment it

Instances

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

Run the given function inside a counter