-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Arrow-like / category-like composition for transformers.
--
-- Arrow-like / category-like composition for transformers.
@package transformers-compose
@version 0.1
-- | This module provides Arrow-like monad composition for transformers. To
-- be more precise, it is Category-like, i.e. the parallels are to
-- Control.Category.Category.
--
-- This version has been adapted from monadLib-compose, to work with
-- the transformers package.
--
-- Control.Category.Category generalises . and id
-- to arrows and categories. One such arrow is Kleisli, which
-- represents functions returning monadic values. Incidentally, that's
-- equivalent to ReaderT! So it turns out that it is possible to
-- generalise . and id to ReaderT (id is just
-- ask), as well as to many monad transformer stacks that embed a
-- ReaderT inside.
module Control.Monad.Compose.Class
-- | Composable monads. Compare with Control.Category.Category.
-- Note that there are two different monad types involved in each
-- instance.
class (Monad m, Monad n) => MonadCompose m n s t | m -> s, n -> t, n s -> m
mcompose :: MonadCompose m n s t => m a -> n s -> n a
mapply :: MonadCompose m n s t => m a -> s -> n a
-- | Compose two monadic values from right to left. Compare with
-- Control.Category.<<<. f <<< g is
-- equivalent to mcompose f g.
(<<<) :: MonadCompose m n s t => m a -> n s -> n a
-- | Compose two monadic values from left to right. Compare with
-- Control.Category.>>>. g >>> f is
-- equivalent to mcompose f g.
(>>>) :: MonadCompose m n s t => n s -> m a -> n a
instance (Monad m, Monoid w) => MonadCompose (RWST s w i m) (RWST t w i m) s t
instance (Monad m, Monoid w) => MonadCompose (RWST s w i m) (RWST t w i m) s t
instance (MonadCompose m n s t, Monoid w) => MonadCompose (WriterT w m) (WriterT w n) s t
instance (MonadCompose m n s t, Monoid w) => MonadCompose (WriterT w m) (WriterT w n) s t
instance MonadCompose m n s t => MonadCompose (StateT i m) (StateT i n) s t
instance MonadCompose m n s t => MonadCompose (StateT i m) (StateT i n) s t
instance (MonadCompose m n s t, Error e) => MonadCompose (ErrorT e m) (ErrorT e n) s t
instance MonadCompose m n s t => MonadCompose (MaybeT m) (MaybeT n) s t
instance MonadCompose m n s t => MonadCompose (IdentityT m) (IdentityT n) s t
instance Monad m => MonadCompose (ReaderT s m) (ReaderT t m) s t
instance MonadCompose ((->) s) ((->) t) s t