    {-# LANGUAGE CPP                    #-}
    {-# LANGUAGE FlexibleInstances      #-}
    {-# LANGUAGE FunctionalDependencies #-}
    {-# LANGUAGE Trustworthy            #-}
    {-# LANGUAGE UndecidableInstances   #-}
    {-# OPTIONS_GHC -fno-warn-warnings-deprecations #-} -- for the ErrorT instances
    -----------------------------------------------------------------------------
    -- | Module     :  Control.Monad.Chronicle.Class
    --
    -- Hybrid error/writer monad class that allows both accumulating outputs and
    -- aborting computation with a final output.
    --
    -- The expected use case is for computations with a notion of fatal vs.
    -- non-fatal errors.
    --
    -----------------------------------------------------------------------------
    module Control.Monad.Chronicle.Class (
        MonadChronicle(..),
        ) where

    import           Control.Applicative
    import           Control.Monad.Trans.Chronicle (ChronicleT)
    import qualified Control.Monad.Trans.Chronicle as Ch
    import           Data.These
    import           Data.These.Combinators

    import Control.Monad.Trans.Except        as Except
    import Control.Monad.Trans.Identity      as Identity
    import Control.Monad.Trans.Maybe         as Maybe
    import Control.Monad.Trans.RWS.Lazy      as LazyRWS
    import Control.Monad.Trans.RWS.Strict    as StrictRWS
    import Control.Monad.Trans.Reader        as Reader
    import Control.Monad.Trans.State.Lazy    as LazyState
    import Control.Monad.Trans.State.Strict  as StrictState
    import Control.Monad.Trans.Writer.Lazy   as LazyWriter
    import Control.Monad.Trans.Writer.Strict as StrictWriter

    #if !(MIN_VERSION_transformers(0,6,0))
    import Control.Monad.Trans.Error as Error
    #endif

    import Control.Monad             (liftM)
    import Control.Monad.Trans.Class (lift)
    import Data.Semigroup
    import Prelude

    class (Monad m) => MonadChronicle c m | m -> c where
        -- | @'dictate' c@ is an action that records the output @c@.
        --
        --   Equivalent to 'tell' for the 'Writer' monad.
        dictate :: c -> m ()

        -- | @'confess' c@ is an action that ends with a final record @c@.
        --
        --   Equivalent to 'throwError' for the 'Error' monad.
        confess :: c -> m a

        -- | @'memento' m@ is an action that executes the action @m@, returning either
        --   its record if it ended with 'confess', or its final value otherwise, with
        --   any record added to the current record.
        --
        --   Similar to 'catchError' in the 'Error' monad, but with a notion of
        --   non-fatal errors (which are accumulated) vs. fatal errors (which are caught
        --   without accumulating).
        memento :: m a -> m (Either c a)

        -- | @'absolve' x m@ is an action that executes the action @m@ and discards any
        --   record it had. The default value @x@ will be used if @m@ ended via
        --   'confess'.
        absolve :: a -> m a -> m a

        -- | @'condemn' m@ is an action that executes the action @m@ and keeps its value
        --   only if it had no record. Otherwise, the value (if any) will be discarded
        --   and only the record kept.
        --
        --   This can be seen as converting non-fatal errors into fatal ones.
        condemn :: m a -> m a

        -- | @'retcon' f m@ is an action that executes the action @m@ and applies the
        --   function @f@ to its output, leaving the return value unchanged.
        --
        --   Equivalent to 'censor' for the 'Writer' monad.
        retcon :: (c -> c) -> m a -> m a

        -- | @'chronicle' m@ lifts a plain @'These' c a@ value into a 'MonadChronicle' instance.
        chronicle :: These c a -> m a

    instance (Semigroup c) => MonadChronicle c (These c) where
        dictate :: c -> These c ()
    dictate c
    c = c -> () -> These c ()
    forall a b. a -> b -> These a b
    These c
    c ()
        confess :: forall a. c -> These c a
    confess c
    c = c -> These c a
    forall a b. a -> These a b
    This c
    c
        memento :: forall a. These c a -> These c (Either c a)
    memento (This c
    c) = Either c a -> These c (Either c a)
    forall a b. b -> These a b
    That (c -> Either c a
    forall a b. a -> Either a b
    Left c
    c)
        memento These c a
    m = (a -> Either c a) -> These c a -> These c (Either c a)
    forall b d a. (b -> d) -> These a b -> These a d
    mapThere a -> Either c a
    forall a b. b -> Either a b
    Right These c a
    m
        absolve :: forall a. a -> These c a -> These c a
    absolve a
    x (This c
    _) = a -> These c a
    forall a b. b -> These a b
    That a
    x
        absolve a
    _ (That a
    x) = a -> These c a
    forall a b. b -> These a b
    That a
    x
        absolve a
    _ (These c
    _ a
    x) = a -> These c a
    forall a b. b -> These a b
    That a
    x
        condemn :: forall a. These c a -> These c a
    condemn (These c
    c a
    _) = c -> These c a
    forall a b. a -> These a b
    This c
    c
        condemn These c a
    m = These c a
    m
        retcon :: forall a. (c -> c) -> These c a -> These c a
    retcon = (c -> c) -> These c a -> These c a
    forall a c b. (a -> c) -> These a b -> These c b
    mapHere
        chronicle :: forall a. These c a -> These c a
    chronicle = These c a -> These c a
    forall a. a -> a
    id

    instance (Semigroup c, Monad m) => MonadChronicle c (ChronicleT c m) where
        dictate :: c -> ChronicleT c m ()
    dictate = c -> ChronicleT c m ()
    forall c (m :: * -> *).
    (Semigroup c, Monad m) =>
    c -> ChronicleT c m ()
    Ch.dictate
        confess :: forall a. c -> ChronicleT c m a
    confess = c -> ChronicleT c m a
    forall c (m :: * -> *) a.
    (Semigroup c, Monad m) =>
    c -> ChronicleT c m a
    Ch.confess
        memento :: forall a. ChronicleT c m a -> ChronicleT c m (Either c a)
    memento = ChronicleT c m a -> ChronicleT c m (Either c a)
    forall c (m :: * -> *) a.
    (Semigroup c, Monad m) =>
    ChronicleT c m a -> ChronicleT c m (Either c a)
    Ch.memento
        absolve :: forall a. a -> ChronicleT c m a -> ChronicleT c m a
    absolve = a -> ChronicleT c m a -> ChronicleT c m a
    forall c (m :: * -> *) a.
    (Semigroup c, Monad m) =>
    a -> ChronicleT c m a -> ChronicleT c m a
    Ch.absolve
        condemn :: forall a. ChronicleT c m a -> ChronicleT c m a
    condemn = ChronicleT c m a -> ChronicleT c m a
    forall c (m :: * -> *) a.
    (Semigroup c, Monad m) =>
    ChronicleT c m a -> ChronicleT c m a
    Ch.condemn
        retcon :: forall a. (c -> c) -> ChronicleT c m a -> ChronicleT c m a
    retcon = (c -> c) -> ChronicleT c m a -> ChronicleT c m a
    forall c (m :: * -> *) a.
    (Semigroup c, Monad m) =>
    (c -> c) -> ChronicleT c m a -> ChronicleT c m a
    Ch.retcon
        chronicle :: forall a. These c a -> ChronicleT c m a
    chronicle = m (These c a) -> ChronicleT c m a
    forall c (m :: * -> *) a. m (These c a) -> ChronicleT c m a
    Ch.ChronicleT (m (These c a) -> ChronicleT c m a)
    -> (These c a -> m (These c a)) -> These c a -> ChronicleT c m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . These c a -> m (These c a)
    forall a. a -> m a
    forall (m :: * -> *) a. Monad m => a -> m a
    return

    instance (MonadChronicle c m) => MonadChronicle c (IdentityT m) where
        dictate :: c -> IdentityT m ()
    dictate = m () -> IdentityT m ()
    forall (m :: * -> *) a. Monad m => m a -> IdentityT m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m () -> IdentityT m ()) -> (c -> m ()) -> c -> IdentityT m ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m ()
    forall c (m :: * -> *). MonadChronicle c m => c -> m ()
    dictate
        confess :: forall a. c -> IdentityT m a
    confess = m a -> IdentityT m a
    forall (m :: * -> *) a. Monad m => m a -> IdentityT m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> IdentityT m a) -> (c -> m a) -> c -> IdentityT m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m a
    forall a. c -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => c -> m a
    confess
        memento :: forall a. IdentityT m a -> IdentityT m (Either c a)
    memento (IdentityT m a
    m) = m (Either c a) -> IdentityT m (Either c a)
    forall (m :: * -> *) a. Monad m => m a -> IdentityT m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m (Either c a) -> IdentityT m (Either c a))
    -> m (Either c a) -> IdentityT m (Either c a)
    forall a b. (a -> b) -> a -> b
    $ m a -> m (Either c a)
    forall a. m a -> m (Either c a)
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    m a -> m (Either c a)
    memento m a
    m
        absolve :: forall a. a -> IdentityT m a -> IdentityT m a
    absolve a
    x (IdentityT m a
    m) = m a -> IdentityT m a
    forall (m :: * -> *) a. Monad m => m a -> IdentityT m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> IdentityT m a) -> m a -> IdentityT m a
    forall a b. (a -> b) -> a -> b
    $ a -> m a -> m a
    forall a. a -> m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => a -> m a -> m a
    absolve a
    x m a
    m
        condemn :: forall a. IdentityT m a -> IdentityT m a
    condemn (IdentityT m a
    m) = m a -> IdentityT m a
    forall (m :: * -> *) a. Monad m => m a -> IdentityT m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> IdentityT m a) -> m a -> IdentityT m a
    forall a b. (a -> b) -> a -> b
    $ m a -> m a
    forall a. m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => m a -> m a
    condemn m a
    m
        retcon :: forall a. (c -> c) -> IdentityT m a -> IdentityT m a
    retcon c -> c
    f (IdentityT m a
    m) = m a -> IdentityT m a
    forall (m :: * -> *) a. Monad m => m a -> IdentityT m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> IdentityT m a) -> m a -> IdentityT m a
    forall a b. (a -> b) -> a -> b
    $ (c -> c) -> m a -> m a
    forall a. (c -> c) -> m a -> m a
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    (c -> c) -> m a -> m a
    retcon c -> c
    f m a
    m
        chronicle :: forall a. These c a -> IdentityT m a
    chronicle = m a -> IdentityT m a
    forall (m :: * -> *) a. Monad m => m a -> IdentityT m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> IdentityT m a)
    -> (These c a -> m a) -> These c a -> IdentityT m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . These c a -> m a
    forall a. These c a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => These c a -> m a
    chronicle

    instance (MonadChronicle c m) => MonadChronicle c (MaybeT m) where
        dictate :: c -> MaybeT m ()
    dictate = m () -> MaybeT m ()
    forall (m :: * -> *) a. Monad m => m a -> MaybeT m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m () -> MaybeT m ()) -> (c -> m ()) -> c -> MaybeT m ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m ()
    forall c (m :: * -> *). MonadChronicle c m => c -> m ()
    dictate
        confess :: forall a. c -> MaybeT m a
    confess = m a -> MaybeT m a
    forall (m :: * -> *) a. Monad m => m a -> MaybeT m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> MaybeT m a) -> (c -> m a) -> c -> MaybeT m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m a
    forall a. c -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => c -> m a
    confess
        memento :: forall a. MaybeT m a -> MaybeT m (Either c a)
    memento (MaybeT m (Maybe a)
    m) = m (Maybe (Either c a)) -> MaybeT m (Either c a)
    forall (m :: * -> *) a. m (Maybe a) -> MaybeT m a
    MaybeT (m (Maybe (Either c a)) -> MaybeT m (Either c a))
    -> m (Maybe (Either c a)) -> MaybeT m (Either c a)
    forall a b. (a -> b) -> a -> b
    $ (c -> Maybe (Either c a))
    -> (Maybe a -> Maybe (Either c a))
    -> Either c (Maybe a)
    -> Maybe (Either c a)
    forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
    either (Either c a -> Maybe (Either c a)
    forall a. a -> Maybe a
    Just (Either c a -> Maybe (Either c a))
    -> (c -> Either c a) -> c -> Maybe (Either c a)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> Either c a
    forall a b. a -> Either a b
    Left) (a -> Either c a
    forall a b. b -> Either a b
    Right (a -> Either c a) -> Maybe a -> Maybe (Either c a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$>) (Either c (Maybe a) -> Maybe (Either c a))
    -> m (Either c (Maybe a)) -> m (Maybe (Either c a))
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    `liftM` m (Maybe a) -> m (Either c (Maybe a))
    forall a. m a -> m (Either c a)
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    m a -> m (Either c a)
    memento m (Maybe a)
    m
        absolve :: forall a. a -> MaybeT m a -> MaybeT m a
    absolve a
    x (MaybeT m (Maybe a)
    m) = m (Maybe a) -> MaybeT m a
    forall (m :: * -> *) a. m (Maybe a) -> MaybeT m a
    MaybeT (m (Maybe a) -> MaybeT m a) -> m (Maybe a) -> MaybeT m a
    forall a b. (a -> b) -> a -> b
    $ Maybe a -> m (Maybe a) -> m (Maybe a)
    forall a. a -> m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => a -> m a -> m a
    absolve (a -> Maybe a
    forall a. a -> Maybe a
    Just a
    x) m (Maybe a)
    m
        condemn :: forall a. MaybeT m a -> MaybeT m a
    condemn (MaybeT m (Maybe a)
    m) = m (Maybe a) -> MaybeT m a
    forall (m :: * -> *) a. m (Maybe a) -> MaybeT m a
    MaybeT (m (Maybe a) -> MaybeT m a) -> m (Maybe a) -> MaybeT m a
    forall a b. (a -> b) -> a -> b
    $ m (Maybe a) -> m (Maybe a)
    forall a. m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => m a -> m a
    condemn m (Maybe a)
    m
        retcon :: forall a. (c -> c) -> MaybeT m a -> MaybeT m a
    retcon c -> c
    f (MaybeT m (Maybe a)
    m) = m (Maybe a) -> MaybeT m a
    forall (m :: * -> *) a. m (Maybe a) -> MaybeT m a
    MaybeT (m (Maybe a) -> MaybeT m a) -> m (Maybe a) -> MaybeT m a
    forall a b. (a -> b) -> a -> b
    $ (c -> c) -> m (Maybe a) -> m (Maybe a)
    forall a. (c -> c) -> m a -> m a
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    (c -> c) -> m a -> m a
    retcon c -> c
    f m (Maybe a)
    m
        chronicle :: forall a. These c a -> MaybeT m a
    chronicle = m a -> MaybeT m a
    forall (m :: * -> *) a. Monad m => m a -> MaybeT m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> MaybeT m a)
    -> (These c a -> m a) -> These c a -> MaybeT m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . These c a -> m a
    forall a. These c a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => These c a -> m a
    chronicle

    #if !(MIN_VERSION_transformers(0,6,0))
    instance (Error e, MonadChronicle c m) => MonadChronicle c (ErrorT e m) where
        dictate = lift . dictate
        confess = lift . confess
        memento (ErrorT m) = ErrorT $ either (Right . Left) (Right <$>) `liftM` memento m
        absolve x (ErrorT m) = ErrorT $ absolve (Right x) m
        condemn (ErrorT m) = ErrorT $ condemn m
        retcon f (ErrorT m) = ErrorT $ retcon f m
        chronicle = lift . chronicle
    #endif

    instance (MonadChronicle c m) => MonadChronicle c (ExceptT e m) where
        dictate :: c -> ExceptT e m ()
    dictate = m () -> ExceptT e m ()
    forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m () -> ExceptT e m ()) -> (c -> m ()) -> c -> ExceptT e m ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m ()
    forall c (m :: * -> *). MonadChronicle c m => c -> m ()
    dictate
        confess :: forall a. c -> ExceptT e m a
    confess = m a -> ExceptT e m a
    forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> ExceptT e m a) -> (c -> m a) -> c -> ExceptT e m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m a
    forall a. c -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => c -> m a
    confess
        memento :: forall a. ExceptT e m a -> ExceptT e m (Either c a)
    memento (ExceptT m (Either e a)
    m) = m (Either e (Either c a)) -> ExceptT e m (Either c a)
    forall e (m :: * -> *) a. m (Either e a) -> ExceptT e m a
    ExceptT (m (Either e (Either c a)) -> ExceptT e m (Either c a))
    -> m (Either e (Either c a)) -> ExceptT e m (Either c a)
    forall a b. (a -> b) -> a -> b
    $ (c -> Either e (Either c a))
    -> (Either e a -> Either e (Either c a))
    -> Either c (Either e a)
    -> Either e (Either c a)
    forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
    either (Either c a -> Either e (Either c a)
    forall a b. b -> Either a b
    Right (Either c a -> Either e (Either c a))
    -> (c -> Either c a) -> c -> Either e (Either c a)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> Either c a
    forall a b. a -> Either a b
    Left) (a -> Either c a
    forall a b. b -> Either a b
    Right (a -> Either c a) -> Either e a -> Either e (Either c a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$>) (Either c (Either e a) -> Either e (Either c a))
    -> m (Either c (Either e a)) -> m (Either e (Either c a))
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    `liftM` m (Either e a) -> m (Either c (Either e a))
    forall a. m a -> m (Either c a)
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    m a -> m (Either c a)
    memento m (Either e a)
    m
        absolve :: forall a. a -> ExceptT e m a -> ExceptT e m a
    absolve a
    x (ExceptT m (Either e a)
    m) = m (Either e a) -> ExceptT e m a
    forall e (m :: * -> *) a. m (Either e a) -> ExceptT e m a
    ExceptT (m (Either e a) -> ExceptT e m a)
    -> m (Either e a) -> ExceptT e m a
    forall a b. (a -> b) -> a -> b
    $ Either e a -> m (Either e a) -> m (Either e a)
    forall a. a -> m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => a -> m a -> m a
    absolve (a -> Either e a
    forall a b. b -> Either a b
    Right a
    x) m (Either e a)
    m
        condemn :: forall a. ExceptT e m a -> ExceptT e m a
    condemn (ExceptT m (Either e a)
    m) = m (Either e a) -> ExceptT e m a
    forall e (m :: * -> *) a. m (Either e a) -> ExceptT e m a
    ExceptT (m (Either e a) -> ExceptT e m a)
    -> m (Either e a) -> ExceptT e m a
    forall a b. (a -> b) -> a -> b
    $ m (Either e a) -> m (Either e a)
    forall a. m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => m a -> m a
    condemn m (Either e a)
    m
        retcon :: forall a. (c -> c) -> ExceptT e m a -> ExceptT e m a
    retcon c -> c
    f (ExceptT m (Either e a)
    m) = m (Either e a) -> ExceptT e m a
    forall e (m :: * -> *) a. m (Either e a) -> ExceptT e m a
    ExceptT (m (Either e a) -> ExceptT e m a)
    -> m (Either e a) -> ExceptT e m a
    forall a b. (a -> b) -> a -> b
    $ (c -> c) -> m (Either e a) -> m (Either e a)
    forall a. (c -> c) -> m a -> m a
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    (c -> c) -> m a -> m a
    retcon c -> c
    f m (Either e a)
    m
        chronicle :: forall a. These c a -> ExceptT e m a
    chronicle = m a -> ExceptT e m a
    forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> ExceptT e m a)
    -> (These c a -> m a) -> These c a -> ExceptT e m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . These c a -> m a
    forall a. These c a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => These c a -> m a
    chronicle

    instance (MonadChronicle c m) => MonadChronicle c (ReaderT r m) where
        dictate :: c -> ReaderT r m ()
    dictate = m () -> ReaderT r m ()
    forall (m :: * -> *) a. Monad m => m a -> ReaderT r m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m () -> ReaderT r m ()) -> (c -> m ()) -> c -> ReaderT r m ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m ()
    forall c (m :: * -> *). MonadChronicle c m => c -> m ()
    dictate
        confess :: forall a. c -> ReaderT r m a
    confess = m a -> ReaderT r m a
    forall (m :: * -> *) a. Monad m => m a -> ReaderT r m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> ReaderT r m a) -> (c -> m a) -> c -> ReaderT r m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m a
    forall a. c -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => c -> m a
    confess
        memento :: forall a. ReaderT r m a -> ReaderT r m (Either c a)
    memento (ReaderT r -> m a
    m) = (r -> m (Either c a)) -> ReaderT r m (Either c a)
    forall r (m :: * -> *) a. (r -> m a) -> ReaderT r m a
    ReaderT ((r -> m (Either c a)) -> ReaderT r m (Either c a))
    -> (r -> m (Either c a)) -> ReaderT r m (Either c a)
    forall a b. (a -> b) -> a -> b
    $ m a -> m (Either c a)
    forall a. m a -> m (Either c a)
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    m a -> m (Either c a)
    memento (m a -> m (Either c a)) -> (r -> m a) -> r -> m (Either c a)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . r -> m a
    m
        absolve :: forall a. a -> ReaderT r m a -> ReaderT r m a
    absolve a
    x (ReaderT r -> m a
    m) = (r -> m a) -> ReaderT r m a
    forall r (m :: * -> *) a. (r -> m a) -> ReaderT r m a
    ReaderT ((r -> m a) -> ReaderT r m a) -> (r -> m a) -> ReaderT r m a
    forall a b. (a -> b) -> a -> b
    $ a -> m a -> m a
    forall a. a -> m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => a -> m a -> m a
    absolve a
    x (m a -> m a) -> (r -> m a) -> r -> m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . r -> m a
    m
        condemn :: forall a. ReaderT r m a -> ReaderT r m a
    condemn (ReaderT r -> m a
    m) = (r -> m a) -> ReaderT r m a
    forall r (m :: * -> *) a. (r -> m a) -> ReaderT r m a
    ReaderT ((r -> m a) -> ReaderT r m a) -> (r -> m a) -> ReaderT r m a
    forall a b. (a -> b) -> a -> b
    $ m a -> m a
    forall a. m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => m a -> m a
    condemn (m a -> m a) -> (r -> m a) -> r -> m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . r -> m a
    m
        retcon :: forall a. (c -> c) -> ReaderT r m a -> ReaderT r m a
    retcon c -> c
    f (ReaderT r -> m a
    m) = (r -> m a) -> ReaderT r m a
    forall r (m :: * -> *) a. (r -> m a) -> ReaderT r m a
    ReaderT ((r -> m a) -> ReaderT r m a) -> (r -> m a) -> ReaderT r m a
    forall a b. (a -> b) -> a -> b
    $ (c -> c) -> m a -> m a
    forall a. (c -> c) -> m a -> m a
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    (c -> c) -> m a -> m a
    retcon c -> c
    f (m a -> m a) -> (r -> m a) -> r -> m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . r -> m a
    m
        chronicle :: forall a. These c a -> ReaderT r m a
    chronicle = m a -> ReaderT r m a
    forall (m :: * -> *) a. Monad m => m a -> ReaderT r m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> ReaderT r m a)
    -> (These c a -> m a) -> These c a -> ReaderT r m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . These c a -> m a
    forall a. These c a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => These c a -> m a
    chronicle

    instance (MonadChronicle c m) => MonadChronicle c (LazyState.StateT s m) where
        dictate :: c -> StateT s m ()
    dictate = m () -> StateT s m ()
    forall (m :: * -> *) a. Monad m => m a -> StateT s m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m () -> StateT s m ()) -> (c -> m ()) -> c -> StateT s m ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m ()
    forall c (m :: * -> *). MonadChronicle c m => c -> m ()
    dictate
        confess :: forall a. c -> StateT s m a
    confess = m a -> StateT s m a
    forall (m :: * -> *) a. Monad m => m a -> StateT s m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> StateT s m a) -> (c -> m a) -> c -> StateT s m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m a
    forall a. c -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => c -> m a
    confess
        memento :: forall a. StateT s m a -> StateT s m (Either c a)
    memento (LazyState.StateT s -> m (a, s)
    m) = (s -> m (Either c a, s)) -> StateT s m (Either c a)
    forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
    LazyState.StateT ((s -> m (Either c a, s)) -> StateT s m (Either c a))
    -> (s -> m (Either c a, s)) -> StateT s m (Either c a)
    forall a b. (a -> b) -> a -> b
    $ \s
    s -> do
            (c -> (Either c a, s))
    -> ((a, s) -> (Either c a, s))
    -> Either c (a, s)
    -> (Either c a, s)
    forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
    either (\c
    c -> (c -> Either c a
    forall a b. a -> Either a b
    Left c
    c, s
    s)) (\(a
    a, s
    s') -> (a -> Either c a
    forall a b. b -> Either a b
    Right a
    a, s
    s')) (Either c (a, s) -> (Either c a, s))
    -> m (Either c (a, s)) -> m (Either c a, s)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    `liftM` m (a, s) -> m (Either c (a, s))
    forall a. m a -> m (Either c a)
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    m a -> m (Either c a)
    memento (s -> m (a, s)
    m s
    s)
        absolve :: forall a. a -> StateT s m a -> StateT s m a
    absolve a
    x (LazyState.StateT s -> m (a, s)
    m) = (s -> m (a, s)) -> StateT s m a
    forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
    LazyState.StateT ((s -> m (a, s)) -> StateT s m a)
    -> (s -> m (a, s)) -> StateT s m a
    forall a b. (a -> b) -> a -> b
    $ \s
    s -> (a, s) -> m (a, s) -> m (a, s)
    forall a. a -> m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => a -> m a -> m a
    absolve (a
    x, s
    s) (m (a, s) -> m (a, s)) -> m (a, s) -> m (a, s)
    forall a b. (a -> b) -> a -> b
    $ s -> m (a, s)
    m s
    s
        condemn :: forall a. StateT s m a -> StateT s m a
    condemn (LazyState.StateT s -> m (a, s)
    m) = (s -> m (a, s)) -> StateT s m a
    forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
    LazyState.StateT ((s -> m (a, s)) -> StateT s m a)
    -> (s -> m (a, s)) -> StateT s m a
    forall a b. (a -> b) -> a -> b
    $ m (a, s) -> m (a, s)
    forall a. m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => m a -> m a
    condemn (m (a, s) -> m (a, s)) -> (s -> m (a, s)) -> s -> m (a, s)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . s -> m (a, s)
    m
        retcon :: forall a. (c -> c) -> StateT s m a -> StateT s m a
    retcon c -> c
    f (LazyState.StateT s -> m (a, s)
    m) = (s -> m (a, s)) -> StateT s m a
    forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
    LazyState.StateT ((s -> m (a, s)) -> StateT s m a)
    -> (s -> m (a, s)) -> StateT s m a
    forall a b. (a -> b) -> a -> b
    $ (c -> c) -> m (a, s) -> m (a, s)
    forall a. (c -> c) -> m a -> m a
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    (c -> c) -> m a -> m a
    retcon c -> c
    f (m (a, s) -> m (a, s)) -> (s -> m (a, s)) -> s -> m (a, s)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . s -> m (a, s)
    m
        chronicle :: forall a. These c a -> StateT s m a
    chronicle = m a -> StateT s m a
    forall (m :: * -> *) a. Monad m => m a -> StateT s m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> StateT s m a)
    -> (These c a -> m a) -> These c a -> StateT s m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . These c a -> m a
    forall a. These c a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => These c a -> m a
    chronicle

    instance (MonadChronicle c m) => MonadChronicle c (StrictState.StateT s m) where
        dictate :: c -> StateT s m ()
    dictate = m () -> StateT s m ()
    forall (m :: * -> *) a. Monad m => m a -> StateT s m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m () -> StateT s m ()) -> (c -> m ()) -> c -> StateT s m ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m ()
    forall c (m :: * -> *). MonadChronicle c m => c -> m ()
    dictate
        confess :: forall a. c -> StateT s m a
    confess = m a -> StateT s m a
    forall (m :: * -> *) a. Monad m => m a -> StateT s m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> StateT s m a) -> (c -> m a) -> c -> StateT s m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m a
    forall a. c -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => c -> m a
    confess
        memento :: forall a. StateT s m a -> StateT s m (Either c a)
    memento (StrictState.StateT s -> m (a, s)
    m) = (s -> m (Either c a, s)) -> StateT s m (Either c a)
    forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
    StrictState.StateT ((s -> m (Either c a, s)) -> StateT s m (Either c a))
    -> (s -> m (Either c a, s)) -> StateT s m (Either c a)
    forall a b. (a -> b) -> a -> b
    $ \s
    s -> do
            (c -> (Either c a, s))
    -> ((a, s) -> (Either c a, s))
    -> Either c (a, s)
    -> (Either c a, s)
    forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
    either (\c
    c -> (c -> Either c a
    forall a b. a -> Either a b
    Left c
    c, s
    s)) (\(a
    a, s
    s') -> (a -> Either c a
    forall a b. b -> Either a b
    Right a
    a, s
    s')) (Either c (a, s) -> (Either c a, s))
    -> m (Either c (a, s)) -> m (Either c a, s)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    `liftM` m (a, s) -> m (Either c (a, s))
    forall a. m a -> m (Either c a)
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    m a -> m (Either c a)
    memento (s -> m (a, s)
    m s
    s)
        absolve :: forall a. a -> StateT s m a -> StateT s m a
    absolve a
    x (StrictState.StateT s -> m (a, s)
    m) = (s -> m (a, s)) -> StateT s m a
    forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
    StrictState.StateT ((s -> m (a, s)) -> StateT s m a)
    -> (s -> m (a, s)) -> StateT s m a
    forall a b. (a -> b) -> a -> b
    $ \s
    s -> (a, s) -> m (a, s) -> m (a, s)
    forall a. a -> m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => a -> m a -> m a
    absolve (a
    x, s
    s) (m (a, s) -> m (a, s)) -> m (a, s) -> m (a, s)
    forall a b. (a -> b) -> a -> b
    $ s -> m (a, s)
    m s
    s
        condemn :: forall a. StateT s m a -> StateT s m a
    condemn (StrictState.StateT s -> m (a, s)
    m) = (s -> m (a, s)) -> StateT s m a
    forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
    StrictState.StateT ((s -> m (a, s)) -> StateT s m a)
    -> (s -> m (a, s)) -> StateT s m a
    forall a b. (a -> b) -> a -> b
    $ m (a, s) -> m (a, s)
    forall a. m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => m a -> m a
    condemn (m (a, s) -> m (a, s)) -> (s -> m (a, s)) -> s -> m (a, s)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . s -> m (a, s)
    m
        retcon :: forall a. (c -> c) -> StateT s m a -> StateT s m a
    retcon c -> c
    f (StrictState.StateT s -> m (a, s)
    m) = (s -> m (a, s)) -> StateT s m a
    forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
    StrictState.StateT ((s -> m (a, s)) -> StateT s m a)
    -> (s -> m (a, s)) -> StateT s m a
    forall a b. (a -> b) -> a -> b
    $ (c -> c) -> m (a, s) -> m (a, s)
    forall a. (c -> c) -> m a -> m a
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    (c -> c) -> m a -> m a
    retcon c -> c
    f (m (a, s) -> m (a, s)) -> (s -> m (a, s)) -> s -> m (a, s)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . s -> m (a, s)
    m
        chronicle :: forall a. These c a -> StateT s m a
    chronicle = m a -> StateT s m a
    forall (m :: * -> *) a. Monad m => m a -> StateT s m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> StateT s m a)
    -> (These c a -> m a) -> These c a -> StateT s m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . These c a -> m a
    forall a. These c a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => These c a -> m a
    chronicle

    instance (Monoid w, MonadChronicle c m) => MonadChronicle c (LazyWriter.WriterT w m) where
        dictate :: c -> WriterT w m ()
    dictate = m () -> WriterT w m ()
    forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m () -> WriterT w m ()) -> (c -> m ()) -> c -> WriterT w m ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m ()
    forall c (m :: * -> *). MonadChronicle c m => c -> m ()
    dictate
        confess :: forall a. c -> WriterT w m a
    confess = m a -> WriterT w m a
    forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> WriterT w m a) -> (c -> m a) -> c -> WriterT w m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m a
    forall a. c -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => c -> m a
    confess
        memento :: forall a. WriterT w m a -> WriterT w m (Either c a)
    memento (LazyWriter.WriterT m (a, w)
    m) = m (Either c a, w) -> WriterT w m (Either c a)
    forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
    LazyWriter.WriterT (m (Either c a, w) -> WriterT w m (Either c a))
    -> m (Either c a, w) -> WriterT w m (Either c a)
    forall a b. (a -> b) -> a -> b
    $
            (c -> (Either c a, w))
    -> ((a, w) -> (Either c a, w))
    -> Either c (a, w)
    -> (Either c a, w)
    forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
    either (\c
    c -> (c -> Either c a
    forall a b. a -> Either a b
    Left c
    c, w
    forall a. Monoid a => a
    mempty)) (\(a
    a, w
    w) -> (a -> Either c a
    forall a b. b -> Either a b
    Right a
    a, w
    w)) (Either c (a, w) -> (Either c a, w))
    -> m (Either c (a, w)) -> m (Either c a, w)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    `liftM` m (a, w) -> m (Either c (a, w))
    forall a. m a -> m (Either c a)
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    m a -> m (Either c a)
    memento m (a, w)
    m
        absolve :: forall a. a -> WriterT w m a -> WriterT w m a
    absolve a
    x (LazyWriter.WriterT m (a, w)
    m) = m (a, w) -> WriterT w m a
    forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
    LazyWriter.WriterT (m (a, w) -> WriterT w m a) -> m (a, w) -> WriterT w m a
    forall a b. (a -> b) -> a -> b
    $ (a, w) -> m (a, w) -> m (a, w)
    forall a. a -> m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => a -> m a -> m a
    absolve (a
    x, w
    forall a. Monoid a => a
    mempty) m (a, w)
    m
        condemn :: forall a. WriterT w m a -> WriterT w m a
    condemn (LazyWriter.WriterT m (a, w)
    m) = m (a, w) -> WriterT w m a
    forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
    LazyWriter.WriterT (m (a, w) -> WriterT w m a) -> m (a, w) -> WriterT w m a
    forall a b. (a -> b) -> a -> b
    $ m (a, w) -> m (a, w)
    forall a. m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => m a -> m a
    condemn m (a, w)
    m
        retcon :: forall a. (c -> c) -> WriterT w m a -> WriterT w m a
    retcon c -> c
    f (LazyWriter.WriterT m (a, w)
    m) = m (a, w) -> WriterT w m a
    forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
    LazyWriter.WriterT (m (a, w) -> WriterT w m a) -> m (a, w) -> WriterT w m a
    forall a b. (a -> b) -> a -> b
    $ (c -> c) -> m (a, w) -> m (a, w)
    forall a. (c -> c) -> m a -> m a
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    (c -> c) -> m a -> m a
    retcon c -> c
    f m (a, w)
    m
        chronicle :: forall a. These c a -> WriterT w m a
    chronicle = m a -> WriterT w m a
    forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> WriterT w m a)
    -> (These c a -> m a) -> These c a -> WriterT w m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . These c a -> m a
    forall a. These c a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => These c a -> m a
    chronicle

    instance (Monoid w, MonadChronicle c m) => MonadChronicle c (StrictWriter.WriterT w m) where
        dictate :: c -> WriterT w m ()
    dictate = m () -> WriterT w m ()
    forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m () -> WriterT w m ()) -> (c -> m ()) -> c -> WriterT w m ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m ()
    forall c (m :: * -> *). MonadChronicle c m => c -> m ()
    dictate
        confess :: forall a. c -> WriterT w m a
    confess = m a -> WriterT w m a
    forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> WriterT w m a) -> (c -> m a) -> c -> WriterT w m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m a
    forall a. c -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => c -> m a
    confess
        memento :: forall a. WriterT w m a -> WriterT w m (Either c a)
    memento (StrictWriter.WriterT m (a, w)
    m) = m (Either c a, w) -> WriterT w m (Either c a)
    forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
    StrictWriter.WriterT (m (Either c a, w) -> WriterT w m (Either c a))
    -> m (Either c a, w) -> WriterT w m (Either c a)
    forall a b. (a -> b) -> a -> b
    $
            (c -> (Either c a, w))
    -> ((a, w) -> (Either c a, w))
    -> Either c (a, w)
    -> (Either c a, w)
    forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
    either (\c
    c -> (c -> Either c a
    forall a b. a -> Either a b
    Left c
    c, w
    forall a. Monoid a => a
    mempty)) (\(a
    a, w
    w) -> (a -> Either c a
    forall a b. b -> Either a b
    Right a
    a, w
    w)) (Either c (a, w) -> (Either c a, w))
    -> m (Either c (a, w)) -> m (Either c a, w)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    `liftM` m (a, w) -> m (Either c (a, w))
    forall a. m a -> m (Either c a)
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    m a -> m (Either c a)
    memento m (a, w)
    m
        absolve :: forall a. a -> WriterT w m a -> WriterT w m a
    absolve a
    x (StrictWriter.WriterT m (a, w)
    m) = m (a, w) -> WriterT w m a
    forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
    StrictWriter.WriterT (m (a, w) -> WriterT w m a) -> m (a, w) -> WriterT w m a
    forall a b. (a -> b) -> a -> b
    $ (a, w) -> m (a, w) -> m (a, w)
    forall a. a -> m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => a -> m a -> m a
    absolve (a
    x, w
    forall a. Monoid a => a
    mempty) m (a, w)
    m
        condemn :: forall a. WriterT w m a -> WriterT w m a
    condemn (StrictWriter.WriterT m (a, w)
    m) = m (a, w) -> WriterT w m a
    forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
    StrictWriter.WriterT (m (a, w) -> WriterT w m a) -> m (a, w) -> WriterT w m a
    forall a b. (a -> b) -> a -> b
    $ m (a, w) -> m (a, w)
    forall a. m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => m a -> m a
    condemn m (a, w)
    m
        retcon :: forall a. (c -> c) -> WriterT w m a -> WriterT w m a
    retcon c -> c
    f (StrictWriter.WriterT m (a, w)
    m) = m (a, w) -> WriterT w m a
    forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
    StrictWriter.WriterT (m (a, w) -> WriterT w m a) -> m (a, w) -> WriterT w m a
    forall a b. (a -> b) -> a -> b
    $ (c -> c) -> m (a, w) -> m (a, w)
    forall a. (c -> c) -> m a -> m a
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    (c -> c) -> m a -> m a
    retcon c -> c
    f m (a, w)
    m
        chronicle :: forall a. These c a -> WriterT w m a
    chronicle = m a -> WriterT w m a
    forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> WriterT w m a)
    -> (These c a -> m a) -> These c a -> WriterT w m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . These c a -> m a
    forall a. These c a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => These c a -> m a
    chronicle

    instance (Monoid w, MonadChronicle c m) => MonadChronicle c (LazyRWS.RWST r w s m) where
        dictate :: c -> RWST r w s m ()
    dictate = m () -> RWST r w s m ()
    forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m () -> RWST r w s m ()) -> (c -> m ()) -> c -> RWST r w s m ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m ()
    forall c (m :: * -> *). MonadChronicle c m => c -> m ()
    dictate
        confess :: forall a. c -> RWST r w s m a
    confess = m a -> RWST r w s m a
    forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> RWST r w s m a) -> (c -> m a) -> c -> RWST r w s m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m a
    forall a. c -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => c -> m a
    confess
        memento :: forall a. RWST r w s m a -> RWST r w s m (Either c a)
    memento (LazyRWS.RWST r -> s -> m (a, s, w)
    m) = (r -> s -> m (Either c a, s, w)) -> RWST r w s m (Either c a)
    forall r w s (m :: * -> *) a.
    (r -> s -> m (a, s, w)) -> RWST r w s m a
    LazyRWS.RWST ((r -> s -> m (Either c a, s, w)) -> RWST r w s m (Either c a))
    -> (r -> s -> m (Either c a, s, w)) -> RWST r w s m (Either c a)
    forall a b. (a -> b) -> a -> b
    $ \r
    r s
    s ->
            (c -> (Either c a, s, w))
    -> ((a, s, w) -> (Either c a, s, w))
    -> Either c (a, s, w)
    -> (Either c a, s, w)
    forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
    either (\c
    c -> (c -> Either c a
    forall a b. a -> Either a b
    Left c
    c, s
    s, w
    forall a. Monoid a => a
    mempty)) (\(a
    a, s
    s', w
    w) -> (a -> Either c a
    forall a b. b -> Either a b
    Right a
    a, s
    s', w
    w)) (Either c (a, s, w) -> (Either c a, s, w))
    -> m (Either c (a, s, w)) -> m (Either c a, s, w)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    `liftM` m (a, s, w) -> m (Either c (a, s, w))
    forall a. m a -> m (Either c a)
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    m a -> m (Either c a)
    memento (r -> s -> m (a, s, w)
    m r
    r s
    s)
        absolve :: forall a. a -> RWST r w s m a -> RWST r w s m a
    absolve a
    x (LazyRWS.RWST r -> s -> m (a, s, w)
    m) = (r -> s -> m (a, s, w)) -> RWST r w s m a
    forall r w s (m :: * -> *) a.
    (r -> s -> m (a, s, w)) -> RWST r w s m a
    LazyRWS.RWST ((r -> s -> m (a, s, w)) -> RWST r w s m a)
    -> (r -> s -> m (a, s, w)) -> RWST r w s m a
    forall a b. (a -> b) -> a -> b
    $ \r
    r s
    s -> (a, s, w) -> m (a, s, w) -> m (a, s, w)
    forall a. a -> m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => a -> m a -> m a
    absolve (a
    x, s
    s, w
    forall a. Monoid a => a
    mempty) (m (a, s, w) -> m (a, s, w)) -> m (a, s, w) -> m (a, s, w)
    forall a b. (a -> b) -> a -> b
    $ r -> s -> m (a, s, w)
    m r
    r s
    s
        condemn :: forall a. RWST r w s m a -> RWST r w s m a
    condemn (LazyRWS.RWST r -> s -> m (a, s, w)
    m) = (r -> s -> m (a, s, w)) -> RWST r w s m a
    forall r w s (m :: * -> *) a.
    (r -> s -> m (a, s, w)) -> RWST r w s m a
    LazyRWS.RWST ((r -> s -> m (a, s, w)) -> RWST r w s m a)
    -> (r -> s -> m (a, s, w)) -> RWST r w s m a
    forall a b. (a -> b) -> a -> b
    $ \r
    r s
    s -> m (a, s, w) -> m (a, s, w)
    forall a. m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => m a -> m a
    condemn (m (a, s, w) -> m (a, s, w)) -> m (a, s, w) -> m (a, s, w)
    forall a b. (a -> b) -> a -> b
    $ r -> s -> m (a, s, w)
    m r
    r s
    s
        retcon :: forall a. (c -> c) -> RWST r w s m a -> RWST r w s m a
    retcon c -> c
    f (LazyRWS.RWST r -> s -> m (a, s, w)
    m) = (r -> s -> m (a, s, w)) -> RWST r w s m a
    forall r w s (m :: * -> *) a.
    (r -> s -> m (a, s, w)) -> RWST r w s m a
    LazyRWS.RWST ((r -> s -> m (a, s, w)) -> RWST r w s m a)
    -> (r -> s -> m (a, s, w)) -> RWST r w s m a
    forall a b. (a -> b) -> a -> b
    $ \r
    r s
    s -> (c -> c) -> m (a, s, w) -> m (a, s, w)
    forall a. (c -> c) -> m a -> m a
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    (c -> c) -> m a -> m a
    retcon c -> c
    f (m (a, s, w) -> m (a, s, w)) -> m (a, s, w) -> m (a, s, w)
    forall a b. (a -> b) -> a -> b
    $ r -> s -> m (a, s, w)
    m r
    r s
    s
        chronicle :: forall a. These c a -> RWST r w s m a
    chronicle = m a -> RWST r w s m a
    forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> RWST r w s m a)
    -> (These c a -> m a) -> These c a -> RWST r w s m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . These c a -> m a
    forall a. These c a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => These c a -> m a
    chronicle

    instance (Monoid w, MonadChronicle c m) => MonadChronicle c (StrictRWS.RWST r w s m) where
        dictate :: c -> RWST r w s m ()
    dictate = m () -> RWST r w s m ()
    forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m () -> RWST r w s m ()) -> (c -> m ()) -> c -> RWST r w s m ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m ()
    forall c (m :: * -> *). MonadChronicle c m => c -> m ()
    dictate
        confess :: forall a. c -> RWST r w s m a
    confess = m a -> RWST r w s m a
    forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> RWST r w s m a) -> (c -> m a) -> c -> RWST r w s m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . c -> m a
    forall a. c -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => c -> m a
    confess
        memento :: forall a. RWST r w s m a -> RWST r w s m (Either c a)
    memento (StrictRWS.RWST r -> s -> m (a, s, w)
    m) = (r -> s -> m (Either c a, s, w)) -> RWST r w s m (Either c a)
    forall r w s (m :: * -> *) a.
    (r -> s -> m (a, s, w)) -> RWST r w s m a
    StrictRWS.RWST ((r -> s -> m (Either c a, s, w)) -> RWST r w s m (Either c a))
    -> (r -> s -> m (Either c a, s, w)) -> RWST r w s m (Either c a)
    forall a b. (a -> b) -> a -> b
    $ \r
    r s
    s ->
            (c -> (Either c a, s, w))
    -> ((a, s, w) -> (Either c a, s, w))
    -> Either c (a, s, w)
    -> (Either c a, s, w)
    forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
    either (\c
    c -> (c -> Either c a
    forall a b. a -> Either a b
    Left c
    c, s
    s, w
    forall a. Monoid a => a
    mempty)) (\(a
    a, s
    s', w
    w) -> (a -> Either c a
    forall a b. b -> Either a b
    Right a
    a, s
    s', w
    w)) (Either c (a, s, w) -> (Either c a, s, w))
    -> m (Either c (a, s, w)) -> m (Either c a, s, w)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    `liftM` m (a, s, w) -> m (Either c (a, s, w))
    forall a. m a -> m (Either c a)
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    m a -> m (Either c a)
    memento (r -> s -> m (a, s, w)
    m r
    r s
    s)
        absolve :: forall a. a -> RWST r w s m a -> RWST r w s m a
    absolve a
    x (StrictRWS.RWST r -> s -> m (a, s, w)
    m) = (r -> s -> m (a, s, w)) -> RWST r w s m a
    forall r w s (m :: * -> *) a.
    (r -> s -> m (a, s, w)) -> RWST r w s m a
    StrictRWS.RWST ((r -> s -> m (a, s, w)) -> RWST r w s m a)
    -> (r -> s -> m (a, s, w)) -> RWST r w s m a
    forall a b. (a -> b) -> a -> b
    $ \r
    r s
    s -> (a, s, w) -> m (a, s, w) -> m (a, s, w)
    forall a. a -> m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => a -> m a -> m a
    absolve (a
    x, s
    s, w
    forall a. Monoid a => a
    mempty) (m (a, s, w) -> m (a, s, w)) -> m (a, s, w) -> m (a, s, w)
    forall a b. (a -> b) -> a -> b
    $ r -> s -> m (a, s, w)
    m r
    r s
    s
        condemn :: forall a. RWST r w s m a -> RWST r w s m a
    condemn (StrictRWS.RWST r -> s -> m (a, s, w)
    m) = (r -> s -> m (a, s, w)) -> RWST r w s m a
    forall r w s (m :: * -> *) a.
    (r -> s -> m (a, s, w)) -> RWST r w s m a
    StrictRWS.RWST ((r -> s -> m (a, s, w)) -> RWST r w s m a)
    -> (r -> s -> m (a, s, w)) -> RWST r w s m a
    forall a b. (a -> b) -> a -> b
    $ \r
    r s
    s -> m (a, s, w) -> m (a, s, w)
    forall a. m a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => m a -> m a
    condemn (m (a, s, w) -> m (a, s, w)) -> m (a, s, w) -> m (a, s, w)
    forall a b. (a -> b) -> a -> b
    $ r -> s -> m (a, s, w)
    m r
    r s
    s
        retcon :: forall a. (c -> c) -> RWST r w s m a -> RWST r w s m a
    retcon c -> c
    f (StrictRWS.RWST r -> s -> m (a, s, w)
    m) = (r -> s -> m (a, s, w)) -> RWST r w s m a
    forall r w s (m :: * -> *) a.
    (r -> s -> m (a, s, w)) -> RWST r w s m a
    StrictRWS.RWST ((r -> s -> m (a, s, w)) -> RWST r w s m a)
    -> (r -> s -> m (a, s, w)) -> RWST r w s m a
    forall a b. (a -> b) -> a -> b
    $ \r
    r s
    s -> (c -> c) -> m (a, s, w) -> m (a, s, w)
    forall a. (c -> c) -> m a -> m a
    forall c (m :: * -> *) a.
    MonadChronicle c m =>
    (c -> c) -> m a -> m a
    retcon c -> c
    f (m (a, s, w) -> m (a, s, w)) -> m (a, s, w) -> m (a, s, w)
    forall a b. (a -> b) -> a -> b
    $ r -> s -> m (a, s, w)
    m r
    r s
    s
        chronicle :: forall a. These c a -> RWST r w s m a
    chronicle = m a -> RWST r w s m a
    forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (m a -> RWST r w s m a)
    -> (These c a -> m a) -> These c a -> RWST r w s m a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . These c a -> m a
    forall a. These c a -> m a
    forall c (m :: * -> *) a. MonadChronicle c m => These c a -> m a
    chronicle