{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE CPP #-}
#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.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)
#if !MIN_VERSION_base(4,11,0)
import Control.Monad.Fail (MonadFail(..))
#endif
infixr 9 `ComposeT`
newtype ComposeT (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *) m a
= ComposeT { ComposeT f g m a -> f (g m) a
getComposeT :: f (g m) a }
deriving
( Applicative (ComposeT f g m)
ComposeT f g m a
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)
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 -> ComposeT f g m [a]
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
many :: 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]
some :: 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]
<|> :: ComposeT f g m a -> ComposeT f g m 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
empty :: ComposeT f g m a
$cempty :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Alternative (f (g m)) =>
ComposeT f g m a
$cp1Alternative :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *).
Alternative (f (g m)) =>
Applicative (ComposeT f g m)
Alternative
, Functor (ComposeT f g m)
a -> ComposeT f g m a
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)
ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m b
ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m a
ComposeT f g m (a -> b) -> ComposeT f g m a -> ComposeT f g m b
(a -> b -> c)
-> ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m c
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
<* :: ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m a
$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
*> :: 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 b
liftA2 :: (a -> b -> c)
-> ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m c
$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
<*> :: ComposeT f g m (a -> b) -> ComposeT f g m a -> ComposeT f g m b
$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
pure :: a -> ComposeT f g m a
$cpure :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Applicative (f (g m)) =>
a -> ComposeT f g m a
$cp1Applicative :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *).
Applicative (f (g m)) =>
Functor (ComposeT f g m)
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
/= :: 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
Eq
, a -> ComposeT f g m a -> Bool
ComposeT f g m m -> m
ComposeT f g m a -> [a]
ComposeT f g m a -> Bool
ComposeT f g m a -> Int
ComposeT f g m a -> a
ComposeT f g m a -> a
ComposeT f g m a -> a
ComposeT f g m a -> a
(a -> m) -> ComposeT f g m a -> m
(a -> m) -> ComposeT f g m a -> m
(a -> b -> b) -> b -> ComposeT f g m a -> b
(a -> b -> b) -> b -> ComposeT f g m a -> b
(b -> a -> b) -> b -> ComposeT f g m a -> b
(b -> a -> b) -> b -> ComposeT f g m a -> b
(a -> a -> a) -> ComposeT f g m a -> a
(a -> a -> a) -> ComposeT f g m a -> a
(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
product :: ComposeT f g m a -> a
$cproduct :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
(Foldable (f (g m)), Num a) =>
ComposeT f g m a -> a
sum :: ComposeT f g m a -> a
$csum :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
(Foldable (f (g m)), Num a) =>
ComposeT f g m a -> a
minimum :: ComposeT f g m a -> a
$cminimum :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
(Foldable (f (g m)), Ord a) =>
ComposeT f g m a -> a
maximum :: ComposeT f g m a -> a
$cmaximum :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
(Foldable (f (g m)), Ord a) =>
ComposeT f g m a -> a
elem :: a -> ComposeT f g m a -> Bool
$celem :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
(Foldable (f (g m)), Eq a) =>
a -> ComposeT f g m a -> Bool
length :: ComposeT f g m a -> Int
$clength :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Foldable (f (g m)) =>
ComposeT f g m a -> Int
null :: ComposeT f g m a -> Bool
$cnull :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Foldable (f (g m)) =>
ComposeT f g m a -> Bool
toList :: ComposeT f g m a -> [a]
$ctoList :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Foldable (f (g m)) =>
ComposeT f g m a -> [a]
foldl1 :: (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
foldr1 :: (a -> a -> a) -> ComposeT f g m a -> a
$cfoldr1 :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Foldable (f (g m)) =>
(a -> a -> a) -> ComposeT f g m a -> a
foldl' :: (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 :: (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
foldr' :: (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 :: (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
foldMap' :: (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 :: (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
fold :: ComposeT f g m m -> m
$cfold :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) m.
(Foldable (f (g m)), Monoid m) =>
ComposeT f g m m -> m
Foldable
, a -> ComposeT f g m b -> ComposeT f g m a
(a -> b) -> ComposeT f g m a -> ComposeT f g m b
(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
<$ :: a -> ComposeT f g m b -> ComposeT f g m a
$c<$ :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Functor (f (g m)) =>
a -> ComposeT f g m b -> ComposeT f g m a
fmap :: (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
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
min :: 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
max :: ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a
$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
>= :: 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
$c< :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Ord (f (g m) a) =>
ComposeT f g m a -> ComposeT f g m a -> Bool
compare :: ComposeT f g m a -> ComposeT f g m a -> Ordering
$ccompare :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Ord (f (g m) a) =>
ComposeT f g m a -> ComposeT f g m a -> Ordering
$cp1Ord :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Ord (f (g m) a) =>
Eq (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]
readListPrec :: ReadPrec [ComposeT f g m a]
$creadListPrec :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Read (f (g m) a) =>
ReadPrec [ComposeT f g m a]
readPrec :: ReadPrec (ComposeT f g m a)
$creadPrec :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Read (f (g m) a) =>
ReadPrec (ComposeT f g m a)
readList :: ReadS [ComposeT f g m a]
$creadList :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Read (f (g m) a) =>
ReadS [ComposeT f g m a]
readsPrec :: Int -> ReadS (ComposeT f g m a)
$creadsPrec :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Read (f (g m) a) =>
Int -> ReadS (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
showList :: [ComposeT f g m a] -> ShowS
$cshowList :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Show (f (g m) a) =>
[ComposeT f g m a] -> ShowS
show :: ComposeT f g m a -> String
$cshow :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Show (f (g m) a) =>
ComposeT f g m a -> String
showsPrec :: Int -> ComposeT f g m a -> ShowS
$cshowsPrec :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Show (f (g m) a) =>
Int -> ComposeT f g m a -> ShowS
Show
, Applicative (ComposeT f g m)
a -> ComposeT f g m a
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)
ComposeT f g m a -> (a -> ComposeT f g m b) -> ComposeT f g m b
ComposeT f g m a -> ComposeT f g m b -> ComposeT f g m b
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
return :: a -> ComposeT f g m a
$creturn :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
Monad (f (g m)) =>
a -> ComposeT f g m a
>> :: ComposeT f g m 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
>>= :: 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
$cp1Monad :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *).
Monad (f (g m)) =>
Applicative (ComposeT f g m)
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)
((a -> ComposeT f g m b) -> ComposeT f g m a) -> ComposeT f g m a
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
callCC :: ((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
$cp1MonadCont :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *).
MonadCont (f (g m)) =>
Monad (ComposeT f g m)
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)
String -> ComposeT f g m a
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
fail :: String -> ComposeT f g m a
$cfail :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
MonadFail (f (g m)) =>
String -> ComposeT f g m a
$cp1MonadFail :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *).
MonadFail (f (g m)) =>
Monad (ComposeT f g m)
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)
IO a -> ComposeT f g m a
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
liftIO :: IO a -> ComposeT f g m a
$cliftIO :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
MonadIO (f (g m)) =>
IO a -> ComposeT f g m a
$cp1MonadIO :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *).
MonadIO (f (g m)) =>
Monad (ComposeT f g m)
MonadIO
, Monad (ComposeT f g m)
Alternative (ComposeT f g m)
ComposeT f g m a
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)
ComposeT f g m a -> ComposeT f g m a -> ComposeT f g m a
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
mplus :: ComposeT f g m a -> ComposeT f g m 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
mzero :: ComposeT f g m a
$cmzero :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *) a.
MonadPlus (f (g m)) =>
ComposeT f g m a
$cp2MonadPlus :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *).
MonadPlus (f (g m)) =>
Monad (ComposeT f g m)
$cp1MonadPlus :: forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
(m :: * -> *).
MonadPlus (f (g m)) =>
Alternative (ComposeT f g m)
MonadPlus
, MonadReader r
, MonadRWS r w s
, MonadState s
, MonadWriter w
)
instance (MFunctor f, MonadTrans f, MonadTrans g) => MonadTrans (ComposeT f g)
where
lift :: 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
hoist forall a. 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 (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 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
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
hoist 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 :: (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