{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE Trustworthy #-}
#if __GLASGOW_HASKELL__ >= 806
{-# LANGUAGE QuantifiedConstraints #-}
#endif
module Control.Monad.Trans.Compose (
ComposeT(ComposeT, getComposeT),
mapComposeT
) where
import Control.Applicative (
Applicative(pure, (<*>), (*>), (<*)), Alternative(empty, (<|>)) )
import Control.Monad (MonadPlus(mzero, mplus), liftM)
import Control.Monad.Cont.Class (MonadCont(callCC))
import Control.Monad.Error.Class (MonadError(throwError, catchError))
import Control.Monad.Fail (MonadFail(..))
import Control.Monad.Morph (MFunctor(hoist))
import Control.Monad.RWS.Class (MonadRWS)
import Control.Monad.Reader.Class (MonadReader(ask, local, reader))
import Control.Monad.State.Class (MonadState(get, put, state))
import Control.Monad.Trans.Class (MonadTrans(lift))
import Control.Monad.Writer.Class (MonadWriter(writer, tell, listen, pass))
import Control.Monad.IO.Class (MonadIO(liftIO))
import Data.Foldable (Foldable(fold, foldMap, foldr, foldl, foldr1, foldl1))
import Data.Traversable (Traversable(traverse, sequenceA, mapM, sequence))
import Prelude hiding (foldr, foldl, foldr1, foldl1, mapM, sequence)
infixr 9 `ComposeT`
newtype ComposeT (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *) m a
= ComposeT { forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
ComposeT f g m a -> f (g m) a
getComposeT :: f (g m) a }
deriving
( Applicative (ComposeT f g m)
Applicative (ComposeT f g m) =>
(forall a. ComposeT f g m a)
-> (forall a.
ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a)
-> (forall a. ComposeT f g m a -> ComposeT f g m [a])
-> (forall a. ComposeT f g m a -> ComposeT f g m [a])
-> Alternative (ComposeT f g m)
forall a. ComposeT f g m a
forall a. ComposeT f g m a -> ComposeT f g m [a]
forall a. ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a
forall (f :: * -> *).
Applicative f =>
(forall a. f a)
-> (forall a. f a -> f a -> f a)
-> (forall a. f a -> f [a])
-> (forall a. f a -> f [a])
-> Alternative f
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *).
Alternative (f (g m)) =>
Applicative (ComposeT f g m)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Alternative (f (g m)) =>
ComposeT f g m a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Alternative (f (g m)) =>
ComposeT f g m a -> ComposeT f g m [a]
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Alternative (f (g m)) =>
ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a
$cempty :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Alternative (f (g m)) =>
ComposeT f g m a
empty :: forall a. ComposeT f g m a
$c<|> :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Alternative (f (g m)) =>
ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a
<|> :: forall a. ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a
$csome :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Alternative (f (g m)) =>
ComposeT f g m a -> ComposeT f g m [a]
some :: forall a. ComposeT f g m a -> ComposeT f g m [a]
$cmany :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Alternative (f (g m)) =>
ComposeT f g m a -> ComposeT f g m [a]
many :: forall a. ComposeT f g m a -> ComposeT f g m [a]
Alternative
, Functor (ComposeT f g m)
Functor (ComposeT f g m) =>
(forall a. a -> ComposeT f g m a)
-> (forall a b.
ComposeT f g m (a -> b) -> ComposeT f g m a -> ComposeT f g m b)
-> (forall a b c.
(a -> b -> c)
-> ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m c)
-> (forall a b.
ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m b)
-> (forall a b.
ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m a)
-> Applicative (ComposeT f g m)
forall a. a -> ComposeT f g m a
forall a b.
ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m a
forall a b.
ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m b
forall a b.
ComposeT f g m (a -> b) -> ComposeT f g m a -> ComposeT f g m b
forall a b c.
(a -> b -> c)
-> ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m c
forall (f :: * -> *).
Functor f =>
(forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *).
Applicative (f (g m)) =>
Functor (ComposeT f g m)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Applicative (f (g m)) =>
a -> ComposeT f g m a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Applicative (f (g m)) =>
ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Applicative (f (g m)) =>
ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m b
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Applicative (f (g m)) =>
ComposeT f g m (a -> b) -> ComposeT f g m a -> ComposeT f g m b
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b c.
Applicative (f (g m)) =>
(a -> b -> c)
-> ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m c
$cpure :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Applicative (f (g m)) =>
a -> ComposeT f g m a
pure :: forall a. a -> ComposeT f g m a
$c<*> :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Applicative (f (g m)) =>
ComposeT f g m (a -> b) -> ComposeT f g m a -> ComposeT f g m b
<*> :: forall a b.
ComposeT f g m (a -> b) -> ComposeT f g m a -> ComposeT f g m b
$cliftA2 :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b c.
Applicative (f (g m)) =>
(a -> b -> c)
-> ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m c
liftA2 :: forall a b c.
(a -> b -> c)
-> ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m c
$c*> :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Applicative (f (g m)) =>
ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m b
*> :: forall a b.
ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m b
$c<* :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Applicative (f (g m)) =>
ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m a
<* :: forall a b.
ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m a
Applicative
, ComposeT f g m a -> ComposeT f g m a -> Bool
(ComposeT f g m a -> ComposeT f g m a -> Bool)
-> (ComposeT f g m a -> ComposeT f g m a -> Bool)
-> Eq (ComposeT f g m a)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Eq (f (g m) a) =>
ComposeT f g m a -> ComposeT f g m a -> Bool
$c== :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Eq (f (g m) a) =>
ComposeT f g m a -> ComposeT f g m a -> Bool
== :: ComposeT f g m a -> ComposeT f g m a -> Bool
$c/= :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Eq (f (g m) a) =>
ComposeT f g m a -> ComposeT f g m a -> Bool
/= :: ComposeT f g m a -> ComposeT f g m a -> Bool
Eq
, (forall m. Monoid m => ComposeT f g m m -> m)
-> (forall m a. Monoid m => (a -> m) -> ComposeT f g m a -> m)
-> (forall m a. Monoid m => (a -> m) -> ComposeT f g m a -> m)
-> (forall a b. (a -> b -> b) -> b -> ComposeT f g m a -> b)
-> (forall a b. (a -> b -> b) -> b -> ComposeT f g m a -> b)
-> (forall b a. (b -> a -> b) -> b -> ComposeT f g m a -> b)
-> (forall b a. (b -> a -> b) -> b -> ComposeT f g m a -> b)
-> (forall a. (a -> a -> a) -> ComposeT f g m a -> a)
-> (forall a. (a -> a -> a) -> ComposeT f g m a -> a)
-> (forall a. ComposeT f g m a -> [a])
-> (forall a. ComposeT f g m a -> Bool)
-> (forall a. ComposeT f g m a -> Int)
-> (forall a. Eq a => a -> ComposeT f g m a -> Bool)
-> (forall a. Ord a => ComposeT f g m a -> a)
-> (forall a. Ord a => ComposeT f g m a -> a)
-> (forall a. Num a => ComposeT f g m a -> a)
-> (forall a. Num a => ComposeT f g m a -> a)
-> Foldable (ComposeT f g m)
forall a. Eq a => a -> ComposeT f g m a -> Bool
forall a. Num a => ComposeT f g m a -> a
forall a. Ord a => ComposeT f g m a -> a
forall m. Monoid m => ComposeT f g m m -> m
forall a. ComposeT f g m a -> Bool
forall a. ComposeT f g m a -> Int
forall a. ComposeT f g m a -> [a]
forall a. (a -> a -> a) -> ComposeT f g m a -> a
forall m a. Monoid m => (a -> m) -> ComposeT f g m a -> m
forall b a. (b -> a -> b) -> b -> ComposeT f g m a -> b
forall a b. (a -> b -> b) -> b -> ComposeT f g m a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
(Foldable (f (g m)), Eq a) =>
a -> ComposeT f g m a -> Bool
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
(Foldable (f (g m)), Num a) =>
ComposeT f g m a -> a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
(Foldable (f (g m)), Ord a) =>
ComposeT f g m a -> a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) m.
(Foldable (f (g m)), Monoid m) =>
ComposeT f g m m -> m
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Foldable (f (g m)) =>
ComposeT f g m a -> Bool
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Foldable (f (g m)) =>
ComposeT f g m a -> Int
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Foldable (f (g m)) =>
ComposeT f g m a -> [a]
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Foldable (f (g m)) =>
(a -> a -> a) -> ComposeT f g m a -> a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) m a.
(Foldable (f (g m)), Monoid m) =>
(a -> m) -> ComposeT f g m a -> m
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) b a.
Foldable (f (g m)) =>
(b -> a -> b) -> b -> ComposeT f g m a -> b
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Foldable (f (g m)) =>
(a -> b -> b) -> b -> ComposeT f g m a -> b
$cfold :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) m.
(Foldable (f (g m)), Monoid m) =>
ComposeT f g m m -> m
fold :: forall m. Monoid m => ComposeT f g m m -> m
$cfoldMap :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) m a.
(Foldable (f (g m)), Monoid m) =>
(a -> m) -> ComposeT f g m a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> ComposeT f g m a -> m
$cfoldMap' :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) m a.
(Foldable (f (g m)), Monoid m) =>
(a -> m) -> ComposeT f g m a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> ComposeT f g m a -> m
$cfoldr :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Foldable (f (g m)) =>
(a -> b -> b) -> b -> ComposeT f g m a -> b
foldr :: forall a b. (a -> b -> b) -> b -> ComposeT f g m a -> b
$cfoldr' :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Foldable (f (g m)) =>
(a -> b -> b) -> b -> ComposeT f g m a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> ComposeT f g m a -> b
$cfoldl :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) b a.
Foldable (f (g m)) =>
(b -> a -> b) -> b -> ComposeT f g m a -> b
foldl :: forall b a. (b -> a -> b) -> b -> ComposeT f g m a -> b
$cfoldl' :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) b a.
Foldable (f (g m)) =>
(b -> a -> b) -> b -> ComposeT f g m a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> ComposeT f g m a -> b
$cfoldr1 :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Foldable (f (g m)) =>
(a -> a -> a) -> ComposeT f g m a -> a
foldr1 :: forall a. (a -> a -> a) -> ComposeT f g m a -> a
$cfoldl1 :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Foldable (f (g m)) =>
(a -> a -> a) -> ComposeT f g m a -> a
foldl1 :: forall a. (a -> a -> a) -> ComposeT f g m a -> a
$ctoList :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Foldable (f (g m)) =>
ComposeT f g m a -> [a]
toList :: forall a. ComposeT f g m a -> [a]
$cnull :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Foldable (f (g m)) =>
ComposeT f g m a -> Bool
null :: forall a. ComposeT f g m a -> Bool
$clength :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Foldable (f (g m)) =>
ComposeT f g m a -> Int
length :: forall a. ComposeT f g m a -> Int
$celem :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
(Foldable (f (g m)), Eq a) =>
a -> ComposeT f g m a -> Bool
elem :: forall a. Eq a => a -> ComposeT f g m a -> Bool
$cmaximum :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
(Foldable (f (g m)), Ord a) =>
ComposeT f g m a -> a
maximum :: forall a. Ord a => ComposeT f g m a -> a
$cminimum :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
(Foldable (f (g m)), Ord a) =>
ComposeT f g m a -> a
minimum :: forall a. Ord a => ComposeT f g m a -> a
$csum :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
(Foldable (f (g m)), Num a) =>
ComposeT f g m a -> a
sum :: forall a. Num a => ComposeT f g m a -> a
$cproduct :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
(Foldable (f (g m)), Num a) =>
ComposeT f g m a -> a
product :: forall a. Num a => ComposeT f g m a -> a
Foldable
, (forall a b. (a -> b) -> ComposeT f g m a -> ComposeT f g m b)
-> (forall a b. a -> ComposeT f g m b -> ComposeT f g m a)
-> Functor (ComposeT f g m)
forall a b. a -> ComposeT f g m b -> ComposeT f g m a
forall a b. (a -> b) -> ComposeT f g m a -> ComposeT f g m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Functor (f (g m)) =>
a -> ComposeT f g m b -> ComposeT f g m a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Functor (f (g m)) =>
(a -> b) -> ComposeT f g m a -> ComposeT f g m b
$cfmap :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Functor (f (g m)) =>
(a -> b) -> ComposeT f g m a -> ComposeT f g m b
fmap :: forall a b. (a -> b) -> ComposeT f g m a -> ComposeT f g m b
$c<$ :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Functor (f (g m)) =>
a -> ComposeT f g m b -> ComposeT f g m a
<$ :: forall a b. a -> ComposeT f g m b -> ComposeT f g m a
Functor
, Eq (ComposeT f g m a)
Eq (ComposeT f g m a) =>
(ComposeT f g m a -> ComposeT f g m a -> Ordering)
-> (ComposeT f g m a -> ComposeT f g m a -> Bool)
-> (ComposeT f g m a -> ComposeT f g m a -> Bool)
-> (ComposeT f g m a -> ComposeT f g m a -> Bool)
-> (ComposeT f g m a -> ComposeT f g m a -> Bool)
-> (ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a)
-> (ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a)
-> Ord (ComposeT f g m a)
ComposeT f g m a -> ComposeT f g m a -> Bool
ComposeT f g m a -> ComposeT f g m a -> Ordering
ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Ord (f (g m) a) =>
Eq (ComposeT f g m a)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Ord (f (g m) a) =>
ComposeT f g m a -> ComposeT f g m a -> Bool
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Ord (f (g m) a) =>
ComposeT f g m a -> ComposeT f g m a -> Ordering
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Ord (f (g m) a) =>
ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a
$ccompare :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Ord (f (g m) a) =>
ComposeT f g m a -> ComposeT f g m a -> Ordering
compare :: ComposeT f g m a -> ComposeT f g m a -> Ordering
$c< :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Ord (f (g m) a) =>
ComposeT f g m a -> ComposeT f g m a -> Bool
< :: ComposeT f g m a -> ComposeT f g m a -> Bool
$c<= :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Ord (f (g m) a) =>
ComposeT f g m a -> ComposeT f g m a -> Bool
<= :: ComposeT f g m a -> ComposeT f g m a -> Bool
$c> :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Ord (f (g m) a) =>
ComposeT f g m a -> ComposeT f g m a -> Bool
> :: ComposeT f g m a -> ComposeT f g m a -> Bool
$c>= :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Ord (f (g m) a) =>
ComposeT f g m a -> ComposeT f g m a -> Bool
>= :: ComposeT f g m a -> ComposeT f g m a -> Bool
$cmax :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Ord (f (g m) a) =>
ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a
max :: ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a
$cmin :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Ord (f (g m) a) =>
ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a
min :: ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a
Ord
, ReadPrec [ComposeT f g m a]
ReadPrec (ComposeT f g m a)
Int -> ReadS (ComposeT f g m a)
ReadS [ComposeT f g m a]
(Int -> ReadS (ComposeT f g m a))
-> ReadS [ComposeT f g m a]
-> ReadPrec (ComposeT f g m a)
-> ReadPrec [ComposeT f g m a]
-> Read (ComposeT f g m a)
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Read (f (g m) a) =>
ReadPrec [ComposeT f g m a]
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Read (f (g m) a) =>
ReadPrec (ComposeT f g m a)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Read (f (g m) a) =>
Int -> ReadS (ComposeT f g m a)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Read (f (g m) a) =>
ReadS [ComposeT f g m a]
$creadsPrec :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Read (f (g m) a) =>
Int -> ReadS (ComposeT f g m a)
readsPrec :: Int -> ReadS (ComposeT f g m a)
$creadList :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Read (f (g m) a) =>
ReadS [ComposeT f g m a]
readList :: ReadS [ComposeT f g m a]
$creadPrec :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Read (f (g m) a) =>
ReadPrec (ComposeT f g m a)
readPrec :: ReadPrec (ComposeT f g m a)
$creadListPrec :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Read (f (g m) a) =>
ReadPrec [ComposeT f g m a]
readListPrec :: ReadPrec [ComposeT f g m a]
Read
, Int -> ComposeT f g m a -> ShowS
[ComposeT f g m a] -> ShowS
ComposeT f g m a -> String
(Int -> ComposeT f g m a -> ShowS)
-> (ComposeT f g m a -> String)
-> ([ComposeT f g m a] -> ShowS)
-> Show (ComposeT f g m a)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Show (f (g m) a) =>
Int -> ComposeT f g m a -> ShowS
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Show (f (g m) a) =>
[ComposeT f g m a] -> ShowS
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Show (f (g m) a) =>
ComposeT f g m a -> String
$cshowsPrec :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Show (f (g m) a) =>
Int -> ComposeT f g m a -> ShowS
showsPrec :: Int -> ComposeT f g m a -> ShowS
$cshow :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Show (f (g m) a) =>
ComposeT f g m a -> String
show :: ComposeT f g m a -> String
$cshowList :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Show (f (g m) a) =>
[ComposeT f g m a] -> ShowS
showList :: [ComposeT f g m a] -> ShowS
Show
, Functor (ComposeT f g m)
Foldable (ComposeT f g m)
(Functor (ComposeT f g m), Foldable (ComposeT f g m)) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ComposeT f g m a -> f (ComposeT f g m b))
-> (forall (f :: * -> *) a.
Applicative f =>
ComposeT f g m (f a) -> f (ComposeT f g m a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ComposeT f g m a -> m (ComposeT f g m b))
-> (forall (m :: * -> *) a.
Monad m =>
ComposeT f g m (m a) -> m (ComposeT f g m a))
-> Traversable (ComposeT f g m)
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
ComposeT f g m (m a) -> m (ComposeT f g m a)
forall (f :: * -> *) a.
Applicative f =>
ComposeT f g m (f a) -> f (ComposeT f g m a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ComposeT f g m a -> m (ComposeT f g m b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ComposeT f g m a -> f (ComposeT f g m b)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *).
Traversable (f (g m)) =>
Functor (ComposeT f g m)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *).
Traversable (f (g m)) =>
Foldable (ComposeT f g m)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) (m :: * -> *) a.
(Traversable (f (g m)), Monad m) =>
ComposeT f g m (m a) -> m (ComposeT f g m a)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) (f :: * -> *) a.
(Traversable (f (g m)), Applicative f) =>
ComposeT f g m (f a) -> f (ComposeT f g m a)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) (m :: * -> *) a b.
(Traversable (f (g m)), Monad m) =>
(a -> m b) -> ComposeT f g m a -> m (ComposeT f g m b)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) (f :: * -> *) a b.
(Traversable (f (g m)), Applicative f) =>
(a -> f b) -> ComposeT f g m a -> f (ComposeT f g m b)
$ctraverse :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) (f :: * -> *) a b.
(Traversable (f (g m)), Applicative f) =>
(a -> f b) -> ComposeT f g m a -> f (ComposeT f g m b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ComposeT f g m a -> f (ComposeT f g m b)
$csequenceA :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) (f :: * -> *) a.
(Traversable (f (g m)), Applicative f) =>
ComposeT f g m (f a) -> f (ComposeT f g m a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
ComposeT f g m (f a) -> f (ComposeT f g m a)
$cmapM :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) (m :: * -> *) a b.
(Traversable (f (g m)), Monad m) =>
(a -> m b) -> ComposeT f g m a -> m (ComposeT f g m b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ComposeT f g m a -> m (ComposeT f g m b)
$csequence :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) (m :: * -> *) a.
(Traversable (f (g m)), Monad m) =>
ComposeT f g m (m a) -> m (ComposeT f g m a)
sequence :: forall (m :: * -> *) a.
Monad m =>
ComposeT f g m (m a) -> m (ComposeT f g m a)
Traversable
, Applicative (ComposeT f g m)
Applicative (ComposeT f g m) =>
(forall a b.
ComposeT f g m a -> (a -> ComposeT f g m b) -> ComposeT f g m b)
-> (forall a b.
ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m b)
-> (forall a. a -> ComposeT f g m a)
-> Monad (ComposeT f g m)
forall a. a -> ComposeT f g m a
forall a b.
ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m b
forall a b.
ComposeT f g m a -> (a -> ComposeT f g m b) -> ComposeT f g m b
forall (m :: * -> *).
Applicative m =>
(forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *).
Monad (f (g m)) =>
Applicative (ComposeT f g m)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Monad (f (g m)) =>
a -> ComposeT f g m a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Monad (f (g m)) =>
ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m b
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Monad (f (g m)) =>
ComposeT f g m a -> (a -> ComposeT f g m b) -> ComposeT f g m b
$c>>= :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Monad (f (g m)) =>
ComposeT f g m a -> (a -> ComposeT f g m b) -> ComposeT f g m b
>>= :: forall a b.
ComposeT f g m a -> (a -> ComposeT f g m b) -> ComposeT f g m b
$c>> :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Monad (f (g m)) =>
ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m b
>> :: forall a b.
ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m b
$creturn :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Monad (f (g m)) =>
a -> ComposeT f g m a
return :: forall a. a -> ComposeT f g m a
Monad
, Monad (ComposeT f g m)
Monad (ComposeT f g m) =>
(forall a b.
((a -> ComposeT f g m b) -> ComposeT f g m a) -> ComposeT f g m a)
-> MonadCont (ComposeT f g m)
forall a b.
((a -> ComposeT f g m b) -> ComposeT f g m a) -> ComposeT f g m a
forall (m :: * -> *).
Monad m =>
(forall a b. ((a -> m b) -> m a) -> m a) -> MonadCont m
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *).
MonadCont (f (g m)) =>
Monad (ComposeT f g m)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
MonadCont (f (g m)) =>
((a -> ComposeT f g m b) -> ComposeT f g m a) -> ComposeT f g m a
$ccallCC :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
MonadCont (f (g m)) =>
((a -> ComposeT f g m b) -> ComposeT f g m a) -> ComposeT f g m a
callCC :: forall a b.
((a -> ComposeT f g m b) -> ComposeT f g m a) -> ComposeT f g m a
MonadCont
, MonadError e
, Monad (ComposeT f g m)
Monad (ComposeT f g m) =>
(forall a. String -> ComposeT f g m a)
-> MonadFail (ComposeT f g m)
forall a. String -> ComposeT f g m a
forall (m :: * -> *).
Monad m =>
(forall a. String -> m a) -> MonadFail m
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *).
MonadFail (f (g m)) =>
Monad (ComposeT f g m)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
MonadFail (f (g m)) =>
String -> ComposeT f g m a
$cfail :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
MonadFail (f (g m)) =>
String -> ComposeT f g m a
fail :: forall a. String -> ComposeT f g m a
MonadFail
, Monad (ComposeT f g m)
Monad (ComposeT f g m) =>
(forall a. IO a -> ComposeT f g m a) -> MonadIO (ComposeT f g m)
forall a. IO a -> ComposeT f g m a
forall (m :: * -> *).
Monad m =>
(forall a. IO a -> m a) -> MonadIO m
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *).
MonadIO (f (g m)) =>
Monad (ComposeT f g m)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
MonadIO (f (g m)) =>
IO a -> ComposeT f g m a
$cliftIO :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
MonadIO (f (g m)) =>
IO a -> ComposeT f g m a
liftIO :: forall a. IO a -> ComposeT f g m a
MonadIO
, Monad (ComposeT f g m)
Alternative (ComposeT f g m)
(Alternative (ComposeT f g m), Monad (ComposeT f g m)) =>
(forall a. ComposeT f g m a)
-> (forall a.
ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a)
-> MonadPlus (ComposeT f g m)
forall a. ComposeT f g m a
forall a. ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a
forall (m :: * -> *).
(Alternative m, Monad m) =>
(forall a. m a) -> (forall a. m a -> m a -> m a) -> MonadPlus m
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *).
MonadPlus (f (g m)) =>
Monad (ComposeT f g m)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *).
MonadPlus (f (g m)) =>
Alternative (ComposeT f g m)
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
MonadPlus (f (g m)) =>
ComposeT f g m a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
MonadPlus (f (g m)) =>
ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a
$cmzero :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
MonadPlus (f (g m)) =>
ComposeT f g m a
mzero :: forall a. ComposeT f g m a
$cmplus :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
MonadPlus (f (g m)) =>
ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a
mplus :: forall a. ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a
MonadPlus
, MonadReader r
, MonadRWS r w s
, MonadState s
, MonadWriter w
)
instance (MFunctor f, MonadTrans f, MonadTrans g) => MonadTrans (ComposeT f g)
where
lift :: forall (m :: * -> *) a. Monad m => m a -> ComposeT f g m a
lift = f (g m) a -> ComposeT f g m a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
f (g m) a -> ComposeT f g m a
ComposeT (f (g m) a -> ComposeT f g m a)
-> (m a -> f (g m) a) -> m a -> ComposeT f g m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. m a -> g m a) -> f m a -> f (g m) a
forall {k} (t :: (* -> *) -> k -> *) (m :: * -> *) (n :: * -> *)
(b :: k).
(MFunctor t, Monad m) =>
(forall a. m a -> n a) -> t m b -> t n b
forall (m :: * -> *) (n :: * -> *) b.
Monad m =>
(forall a. m a -> n a) -> f m b -> f n b
hoist m a -> g m a
forall a. m a -> g m a
forall (m :: * -> *) a. Monad m => m a -> g m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (f m a -> f (g m) a) -> (m a -> f m a) -> m a -> f (g m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m a -> f m a
forall (m :: * -> *) a. Monad m => m a -> f m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift
#if __GLASGOW_HASKELL__ >= 806
instance (MFunctor f, MFunctor g, forall m. Monad m => Monad (g m))
=> MFunctor (ComposeT f g) where
hoist :: forall (m :: * -> *) (n :: * -> *) b.
Monad m =>
(forall a. m a -> n a) -> ComposeT f g m b -> ComposeT f g n b
hoist forall a. m a -> n a
f (ComposeT f (g m) b
m) = f (g n) b -> ComposeT f g n b
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
f (g m) a -> ComposeT f g m a
ComposeT ((forall a. g m a -> g n a) -> f (g m) b -> f (g n) b
forall {k} (t :: (* -> *) -> k -> *) (m :: * -> *) (n :: * -> *)
(b :: k).
(MFunctor t, Monad m) =>
(forall a. m a -> n a) -> t m b -> t n b
forall (m :: * -> *) (n :: * -> *) b.
Monad m =>
(forall a. m a -> n a) -> f m b -> f n b
hoist ((forall a. m a -> n a) -> g m a -> g n a
forall {k} (t :: (* -> *) -> k -> *) (m :: * -> *) (n :: * -> *)
(b :: k).
(MFunctor t, Monad m) =>
(forall a. m a -> n a) -> t m b -> t n b
forall (m :: * -> *) (n :: * -> *) b.
Monad m =>
(forall a. m a -> n a) -> g m b -> g n b
hoist m a -> n a
forall a. m a -> n a
f) f (g m) b
m)
#endif
mapComposeT :: (f (g m) a -> p (q n) b) -> ComposeT f g m a -> ComposeT p q n b
mapComposeT :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a (p :: (* -> *) -> * -> *) (q :: (* -> *) -> * -> *)
(n :: * -> *) b.
(f (g m) a -> p (q n) b) -> ComposeT f g m a -> ComposeT p q n b
mapComposeT f (g m) a -> p (q n) b
f = p (q n) b -> ComposeT p q n b
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
f (g m) a -> ComposeT f g m a
ComposeT (p (q n) b -> ComposeT p q n b)
-> (ComposeT f g m a -> p (q n) b)
-> ComposeT f g m a
-> ComposeT p q n b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. f (g m) a -> p (q n) b
f (f (g m) a -> p (q n) b)
-> (ComposeT f g m a -> f (g m) a) -> ComposeT f g m a -> p (q n) b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ComposeT f g m a -> f (g m) a
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
ComposeT f g m a -> f (g m) a
getComposeT