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

Safe HaskellSafe-Inferred

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 whereSource

Typeclass for all counter monads.

Methods

countOn :: m IntSource

Tell the current number and increment it

Instances

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

Run the given function inside a counter