-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Pure logger typeclass and monad transformer
--   
--   This package provides a typeclass for logging in pure code, or more
--   generally, in any kind of context. You can do whatever you want with
--   logs, especially get them, clear them or even sink them through
--   <a>IO</a> if you're logging in <tt>(MonadIO m) =&gt; m</tt>.
@package monad-journal
@version 0.7.2


-- | <tt>MonadWriter</tt> on steroids.
--   
--   <a>MonadJournal</a> is a more controlable version of
--   <tt>MonadWriter</tt> because it enables you to access the
--   <a>Monoid</a> being computed up. You can then access logs inside the
--   computation itself, whereas you cannot with <tt>MonadWriter</tt> –
--   unless you use specific functions like <tt>listen</tt>, but that still
--   stacks <a>Monoid</a> in the monad.
--   
--   Typically, you can use <a>MonadJournal</a> when you come across the
--   logging problem and you need logs as long as you proceed.
module Control.Monad.Journal.Class

-- | This typeclass provides the ability to accumulate <a>Monoid</a> in a
--   monad via the <a>journal</a> function; to get them via the
--   <a>history</a> function and finally, to purge them all with the
--   <a>clear</a> function.
--   
--   In most cases, you won’t need <a>history</a> neither <a>clear</a>.
--   There’s a cool function that combines both and enables you to deal
--   with the <a>Monoid</a>: <a>sink</a>.
class (Monoid w, Monad m) => MonadJournal w m | m -> w

-- | Log something.
journal :: MonadJournal w m => w -> m ()

-- | Extract the logs history.
history :: MonadJournal w m => m w

-- | Clear the logs history.
clear :: MonadJournal w m => m ()

-- | Sink all logs history through <a>MonadIO</a> then clean it.
sink :: (MonadJournal w m, MonadIO m) => (w -> IO ()) -> m ()

-- | Absorb a logs history and pass around the value.
absorb :: (MonadJournal w m) => (a, w) -> m a
instance (GHC.Base.Monad m, GHC.Base.Monoid w, Control.Monad.Journal.Class.MonadJournal w m) => Control.Monad.Journal.Class.MonadJournal w (Control.Monad.Trans.Identity.IdentityT m)
instance (GHC.Base.Monad m, GHC.Base.Monoid w, Control.Monad.Journal.Class.MonadJournal w m) => Control.Monad.Journal.Class.MonadJournal w (Control.Monad.Trans.List.ListT m)
instance (GHC.Base.Monad m, GHC.Base.Monoid w, Control.Monad.Journal.Class.MonadJournal w m) => Control.Monad.Journal.Class.MonadJournal w (Control.Monad.Trans.Maybe.MaybeT m)
instance (GHC.Base.Monad m, GHC.Base.Monoid w, Control.Monad.Journal.Class.MonadJournal w m) => Control.Monad.Journal.Class.MonadJournal w (Control.Monad.Trans.RWS.Lazy.RWST r w s m)
instance (GHC.Base.Monad m, GHC.Base.Monoid w, Control.Monad.Journal.Class.MonadJournal w m) => Control.Monad.Journal.Class.MonadJournal w (Control.Monad.Trans.Reader.ReaderT r m)
instance (GHC.Base.Monad m, GHC.Base.Monoid w, Control.Monad.Journal.Class.MonadJournal w m) => Control.Monad.Journal.Class.MonadJournal w (Control.Monad.Trans.State.Lazy.StateT s m)
instance (GHC.Base.Monad m, GHC.Base.Monoid w, GHC.Base.Monoid q, Control.Monad.Journal.Class.MonadJournal w m) => Control.Monad.Journal.Class.MonadJournal w (Control.Monad.Trans.Writer.Lazy.WriterT q m)
instance (GHC.Base.Monad m, GHC.Base.Monoid w, Control.Monad.Journal.Class.MonadJournal w m) => Control.Monad.Journal.Class.MonadJournal w (Control.Monad.Trans.Either.EitherT e m)


-- | Monad transformer version of <a>MonadJournal</a>. <a>JournalT</a>
--   provides journaling over a monad.
--   
--   This modules defines a few useful instances. Check the list below for
--   further information.
module Control.Monad.Trans.Journal

-- | Transformer version of <a>MonadJournal</a>.
data JournalT w m a

-- | Retrieve the value and the log history.
runJournalT :: (Monoid w, Monad m) => JournalT w m a -> m (a, w)

-- | Only retrieve the value.
evalJournalT :: (Monoid w, Monad m) => JournalT w m a -> m a

-- | Only retrieve the log history.
execJournalT :: (Monoid w, Monad m) => JournalT w m a -> m w
instance Control.Monad.Writer.Class.MonadWriter w' m => Control.Monad.Writer.Class.MonadWriter w' (Control.Monad.Trans.Journal.JournalT w m)
instance Control.Monad.Trans.Class.MonadTrans (Control.Monad.Trans.Journal.JournalT w)
instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (Control.Monad.Trans.Journal.JournalT w m)
instance GHC.Base.MonadPlus m => GHC.Base.MonadPlus (Control.Monad.Trans.Journal.JournalT w m)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Monad.Trans.Journal.JournalT w m)
instance Control.Monad.Error.Class.MonadError e m => Control.Monad.Error.Class.MonadError e (Control.Monad.Trans.Journal.JournalT w m)
instance GHC.Base.Monad m => GHC.Base.Monad (Control.Monad.Trans.Journal.JournalT w m)
instance GHC.Base.Functor m => GHC.Base.Functor (Control.Monad.Trans.Journal.JournalT w m)
instance GHC.Base.MonadPlus m => GHC.Base.Alternative (Control.Monad.Trans.Journal.JournalT w m)
instance GHC.Base.Monad m => GHC.Base.Applicative (Control.Monad.Trans.Journal.JournalT w m)
instance (GHC.Base.Monoid w, GHC.Base.Monad m) => Control.Monad.Journal.Class.MonadJournal w (Control.Monad.Trans.Journal.JournalT w m)
instance Control.Monad.State.Class.MonadState s m => Control.Monad.State.Class.MonadState s (Control.Monad.Trans.Journal.JournalT w m)
instance Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Monad.Trans.Journal.JournalT w m)
instance GHC.Base.Monoid w => Control.Monad.Trans.Control.MonadTransControl (Control.Monad.Trans.Journal.JournalT w)
instance (GHC.Base.Monoid w, Control.Monad.Trans.Control.MonadBaseControl b m) => Control.Monad.Trans.Control.MonadBaseControl b (Control.Monad.Trans.Journal.JournalT w m)


-- | This module re-exports anything about the <a>MonadJournal</a>
--   *typeclass*.
module Control.Monad.Journal
