Data.Chatty.Counter
Description
Provides a counter monad.
newtype CounterT m a Source #
A counter monad.
Constructors
Fields
Defined in Data.Chatty.Counter
Methods
lift :: Monad m => m a -> CounterT m a #
(>>=) :: CounterT m a -> (a -> CounterT m b) -> CounterT m b #
(>>) :: CounterT m a -> CounterT m b -> CounterT m b #
return :: a -> CounterT m a #
fmap :: (a -> b) -> CounterT m a -> CounterT m b #
(<$) :: a -> CounterT m b -> CounterT m a #
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 #
countOn :: CounterT m Int Source #
class Monad m => ChCounter m where Source #
Typeclass for all counter monads.
countOn :: m Int Source #
Tell the current number and increment it
Defined in Data.Chatty.Atoms
countOn :: AtomStoreT m Int Source #
withCounter :: (Monad m, Functor m) => CounterT m a -> m a Source #
Run the given function inside a counter