chatty-utils-0.7.3.4: Some utilities every serious chatty-based application may need.
Data.Chatty.Counter
Description
Provides a counter monad.
Synopsis
newtype CounterT m a Source #
A counter monad.
Constructors
Fields
Instances
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 #
fail :: String -> 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 #
(*>) :: 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.
Minimal complete definition
countOn
countOn :: m Int Source #
Tell the current number and increment it
countOn :: AtomStoreT m Int Source #
withCounter :: (Monad m, Functor m) => CounterT m a -> m a Source #
Run the given function inside a counter