chatty-utils-0.7.3.5: 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

Instances

Instances details
MonadTrans CounterT Source # 
Instance details

Defined in Data.Chatty.Counter

Methods

lift :: Monad m => m a -> CounterT m a #

Monad m => Monad (CounterT m) Source # 
Instance details

Defined in Data.Chatty.Counter

Methods

(>>=) :: CounterT m a -> (a -> CounterT m b) -> CounterT m b #

(>>) :: CounterT m a -> CounterT m b -> CounterT m b #

return :: a -> CounterT m a #

Functor m => Functor (CounterT m) Source # 
Instance details

Defined in Data.Chatty.Counter

Methods

fmap :: (a -> b) -> CounterT m a -> CounterT m b #

(<$) :: a -> CounterT m b -> CounterT m a #

(Functor m, Monad m) => Applicative (CounterT m) Source # 
Instance details

Defined in Data.Chatty.Counter

Methods

pure :: a -> CounterT m a #

(<*>) :: CounterT m (a -> b) -> CounterT m a -> CounterT m b #

liftA2 :: (a -> b -> c) -> CounterT m a -> CounterT m b -> CounterT m c #

(*>) :: CounterT m a -> CounterT m b -> CounterT m b #

(<*) :: CounterT m a -> CounterT m b -> CounterT m a #

Monad m => ChCounter (CounterT m) Source # 
Instance details

Defined in Data.Chatty.Counter

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

Instances details
Monad m => ChCounter (CounterT m) Source # 
Instance details

Defined in Data.Chatty.Counter

ChCounter m => ChCounter (AtomStoreT m) Source # 
Instance details

Defined in Data.Chatty.Atoms

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

Run the given function inside a counter