{-# LANGUAGE CPP #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE UndecidableInstances #-}
module Control.Monad.Trans.Compose where
import Control.Applicative
import Control.Monad
import Control.Monad.Base
import Control.Monad.Fix
import Control.Monad.IO.Class
import Control.Monad.Trans.Class
import Control.Monad.Trans.Control
import Control.Monad.Trans.Control.Identity
import Control.Monad.Trans.Elevator
import Control.Monad.Zip
import Data.Kind
import Control.Monad.Trans.Except qualified as T
import Control.Monad.Trans.Maybe qualified as T
#if defined(VERSION_exceptions)
import Control.Monad.Catch qualified as Exceptions
import Control.Monad.Catch.Pure qualified as Exceptions.T
#endif
#if defined(VERSION_logict)
import Control.Monad.Logic qualified as LogicT.T
import Control.Monad.Logic.Class qualified as LogicT
#endif
#if defined(VERSION_monad_logger)
import Control.Monad.Logger qualified as MonadLogger
#endif
#if defined(VERSION_mtl)
import Control.Monad.Accum qualified as Mtl
import Control.Monad.Accum.OrphanInstances qualified as Mtl ()
import Control.Monad.Cont.Class qualified as Mtl
import Control.Monad.Error.Class qualified as Mtl
import Control.Monad.Reader.Class qualified as Mtl
import Control.Monad.RWS.Class qualified as Mtl (MonadRWS)
import Control.Monad.Select qualified as Mtl
import Control.Monad.Select.OrphanInstances qualified as Mtl ()
import Control.Monad.State.Class qualified as Mtl
import Control.Monad.Trans.Accum qualified as Mtl.T
import Control.Monad.Trans.Cont qualified as Mtl.T
import Control.Monad.Trans.Except qualified as Mtl.T
import Control.Monad.Trans.RWS.CPS qualified as Mtl.CPST
import Control.Monad.Trans.RWS.Lazy qualified as Mtl.LT
import Control.Monad.Trans.RWS.Strict qualified as Mtl.ST
import Control.Monad.Trans.Reader qualified as Mtl.T
import Control.Monad.Trans.Select qualified as Mtl.T
import Control.Monad.Trans.State.Lazy qualified as Mtl.LT
import Control.Monad.Trans.State.Strict qualified as Mtl.ST
import Control.Monad.Trans.Writer.CPS qualified as Mtl.CPST
import Control.Monad.Trans.Writer.Lazy qualified as Mtl.LT
import Control.Monad.Trans.Writer.Strict qualified as Mtl.ST
import Control.Monad.Writer.Class qualified as Mtl
import Data.Functor.Identity qualified as Mtl
#endif
#if defined(VERSION_primitive)
import Control.Monad.Primitive qualified as Primitive
#endif
#if defined(VERSION_random)
import Data.Functor.Const qualified as Random
import System.Random.Stateful qualified as Random
#endif
#if defined(VERSION_resourcet)
import Control.Monad.Trans.Resource qualified as ResourceT
#endif
#if defined(VERSION_unliftio_core)
import Control.Monad.IO.Unlift qualified as UnliftIO
#endif
type ComposeT :: ((Type -> Type) -> Type -> Type)
-> ((Type -> Type) -> Type -> Type)
-> (Type -> Type)
-> Type
-> Type
newtype ComposeT t1 t2 m a = ComposeT { forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
ComposeT t1 t2 m a -> t1 (t2 m) a
deComposeT :: t1 (t2 m) a }
deriving newtype (Functor (ComposeT t1 t2 m)
Functor (ComposeT t1 t2 m) =>
(forall a. a -> ComposeT t1 t2 m a)
-> (forall a b.
ComposeT t1 t2 m (a -> b)
-> ComposeT t1 t2 m a -> ComposeT t1 t2 m b)
-> (forall a b c.
(a -> b -> c)
-> ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m c)
-> (forall a b.
ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m b)
-> (forall a b.
ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m a)
-> Applicative (ComposeT t1 t2 m)
forall a. a -> ComposeT t1 t2 m a
forall a b.
ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m a
forall a b.
ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m b
forall a b.
ComposeT t1 t2 m (a -> b)
-> ComposeT t1 t2 m a -> ComposeT t1 t2 m b
forall a b c.
(a -> b -> c)
-> ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 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 (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *).
Applicative (t1 (t2 m)) =>
Functor (ComposeT t1 t2 m)
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
Applicative (t1 (t2 m)) =>
a -> ComposeT t1 t2 m a
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Applicative (t1 (t2 m)) =>
ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m a
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Applicative (t1 (t2 m)) =>
ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m b
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Applicative (t1 (t2 m)) =>
ComposeT t1 t2 m (a -> b)
-> ComposeT t1 t2 m a -> ComposeT t1 t2 m b
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a b c.
Applicative (t1 (t2 m)) =>
(a -> b -> c)
-> ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m c
$cpure :: forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
Applicative (t1 (t2 m)) =>
a -> ComposeT t1 t2 m a
pure :: forall a. a -> ComposeT t1 t2 m a
$c<*> :: forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Applicative (t1 (t2 m)) =>
ComposeT t1 t2 m (a -> b)
-> ComposeT t1 t2 m a -> ComposeT t1 t2 m b
<*> :: forall a b.
ComposeT t1 t2 m (a -> b)
-> ComposeT t1 t2 m a -> ComposeT t1 t2 m b
$cliftA2 :: forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a b c.
Applicative (t1 (t2 m)) =>
(a -> b -> c)
-> ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m c
liftA2 :: forall a b c.
(a -> b -> c)
-> ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m c
$c*> :: forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Applicative (t1 (t2 m)) =>
ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m b
*> :: forall a b.
ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m b
$c<* :: forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Applicative (t1 (t2 m)) =>
ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m a
<* :: forall a b.
ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m a
Applicative, (forall a b. (a -> b) -> ComposeT t1 t2 m a -> ComposeT t1 t2 m b)
-> (forall a b. a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m a)
-> Functor (ComposeT t1 t2 m)
forall a b. a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m a
forall a b. (a -> b) -> ComposeT t1 t2 m a -> ComposeT t1 t2 m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Functor (t1 (t2 m)) =>
a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m a
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Functor (t1 (t2 m)) =>
(a -> b) -> ComposeT t1 t2 m a -> ComposeT t1 t2 m b
$cfmap :: forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Functor (t1 (t2 m)) =>
(a -> b) -> ComposeT t1 t2 m a -> ComposeT t1 t2 m b
fmap :: forall a b. (a -> b) -> ComposeT t1 t2 m a -> ComposeT t1 t2 m b
$c<$ :: forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Functor (t1 (t2 m)) =>
a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m a
<$ :: forall a b. a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m a
Functor, Applicative (ComposeT t1 t2 m)
Applicative (ComposeT t1 t2 m) =>
(forall a b.
ComposeT t1 t2 m a
-> (a -> ComposeT t1 t2 m b) -> ComposeT t1 t2 m b)
-> (forall a b.
ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m b)
-> (forall a. a -> ComposeT t1 t2 m a)
-> Monad (ComposeT t1 t2 m)
forall a. a -> ComposeT t1 t2 m a
forall a b.
ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m b
forall a b.
ComposeT t1 t2 m a
-> (a -> ComposeT t1 t2 m b) -> ComposeT t1 t2 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 (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *).
Monad (t1 (t2 m)) =>
Applicative (ComposeT t1 t2 m)
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
Monad (t1 (t2 m)) =>
a -> ComposeT t1 t2 m a
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Monad (t1 (t2 m)) =>
ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m b
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Monad (t1 (t2 m)) =>
ComposeT t1 t2 m a
-> (a -> ComposeT t1 t2 m b) -> ComposeT t1 t2 m b
$c>>= :: forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Monad (t1 (t2 m)) =>
ComposeT t1 t2 m a
-> (a -> ComposeT t1 t2 m b) -> ComposeT t1 t2 m b
>>= :: forall a b.
ComposeT t1 t2 m a
-> (a -> ComposeT t1 t2 m b) -> ComposeT t1 t2 m b
$c>> :: forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a b.
Monad (t1 (t2 m)) =>
ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m b
>> :: forall a b.
ComposeT t1 t2 m a -> ComposeT t1 t2 m b -> ComposeT t1 t2 m b
$creturn :: forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
Monad (t1 (t2 m)) =>
a -> ComposeT t1 t2 m a
return :: forall a. a -> ComposeT t1 t2 m a
Monad)
instance (MonadTrans t1, MonadTrans t2) => MonadTrans (ComposeT t1 t2) where
lift :: forall (m :: * -> *) a. Monad m => m a -> ComposeT t1 t2 m a
lift = t1 (t2 m) a -> ComposeT t1 t2 m a
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
t1 (t2 m) a -> ComposeT t1 t2 m a
ComposeT (t1 (t2 m) a -> ComposeT t1 t2 m a)
-> (m a -> t1 (t2 m) a) -> m a -> ComposeT t1 t2 m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t2 m a -> t1 (t2 m) a
forall (m :: * -> *) a. Monad m => m a -> t1 m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (t2 m a -> t1 (t2 m) a) -> (m a -> t2 m a) -> m a -> t1 (t2 m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m a -> t2 m a
forall (m :: * -> *) a. Monad m => m a -> t2 m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift
instance (MonadTransControl t1, MonadTransControl t2) => MonadTransControl (ComposeT t1 t2) where
type StT (ComposeT t1 t2) a = StT t2 (StT t1 a)
liftWith :: forall (m :: * -> *) a.
Monad m =>
(Run (ComposeT t1 t2) -> m a) -> ComposeT t1 t2 m a
liftWith Run (ComposeT t1 t2) -> m a
f = (forall b. t1 (t2 m) b -> ComposeT t1 t2 m b)
-> (forall (o :: * -> *) b. ComposeT t1 t2 o b -> t1 (t2 o) b)
-> ((forall {m :: * -> *} {b}.
(Monad m, Monad (t2 m)) =>
ComposeT t1 t2 m b -> m (StT t2 (StT t1 b)))
-> m a)
-> ComposeT t1 t2 m a
forall (m :: * -> *) (n' :: (* -> *) -> * -> *)
(n :: (* -> *) -> * -> *) (t :: (* -> *) -> * -> *) a.
(Monad m, Monad (n' m), MonadTransControl n,
MonadTransControl n') =>
(forall b. n (n' m) b -> t m b)
-> (forall (o :: * -> *) b. t o b -> n (n' o) b)
-> (RunDefault2 t n n' -> m a)
-> t m a
defaultLiftWith2 t1 (t2 m) b -> ComposeT t1 t2 m b
forall b. t1 (t2 m) b -> ComposeT t1 t2 m b
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
t1 (t2 m) a -> ComposeT t1 t2 m a
ComposeT ComposeT t1 t2 o b -> t1 (t2 o) b
forall (o :: * -> *) b. ComposeT t1 t2 o b -> t1 (t2 o) b
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
ComposeT t1 t2 m a -> t1 (t2 m) a
deComposeT (((forall {m :: * -> *} {b}.
(Monad m, Monad (t2 m)) =>
ComposeT t1 t2 m b -> m (StT t2 (StT t1 b)))
-> m a)
-> ComposeT t1 t2 m a)
-> ((forall {m :: * -> *} {b}.
(Monad m, Monad (t2 m)) =>
ComposeT t1 t2 m b -> m (StT t2 (StT t1 b)))
-> m a)
-> ComposeT t1 t2 m a
forall a b. (a -> b) -> a -> b
$ \ forall {m :: * -> *} {b}.
(Monad m, Monad (t2 m)) =>
ComposeT t1 t2 m b -> m (StT t2 (StT t1 b))
x -> Run (ComposeT t1 t2) -> m a
f ComposeT t1 t2 n b -> n (StT t2 (StT t1 b))
ComposeT t1 t2 n b -> n (StT (ComposeT t1 t2) b)
forall {m :: * -> *} {b}.
(Monad m, Monad (t2 m)) =>
ComposeT t1 t2 m b -> m (StT t2 (StT t1 b))
Run (ComposeT t1 t2)
x
restoreT :: forall (m :: * -> *) a.
Monad m =>
m (StT (ComposeT t1 t2) a) -> ComposeT t1 t2 m a
restoreT = (t1 (t2 m) a -> ComposeT t1 t2 m a)
-> m (StT t2 (StT t1 a)) -> ComposeT t1 t2 m a
forall (m :: * -> *) (n' :: (* -> *) -> * -> *)
(n :: (* -> *) -> * -> *) a (t :: (* -> *) -> * -> *).
(Monad m, Monad (n' m), MonadTransControl n,
MonadTransControl n') =>
(n (n' m) a -> t m a) -> m (StT n' (StT n a)) -> t m a
defaultRestoreT2 t1 (t2 m) a -> ComposeT t1 t2 m a
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
t1 (t2 m) a -> ComposeT t1 t2 m a
ComposeT
instance (MonadTransControlIdentity t1, MonadTransControlIdentity t2) => MonadTransControlIdentity (ComposeT t1 t2) where
liftWithIdentity :: forall (m :: * -> *) a.
Monad m =>
((forall x. ComposeT t1 t2 m x -> m x) -> m a)
-> ComposeT t1 t2 m a
liftWithIdentity (forall x. ComposeT t1 t2 m x -> m x) -> m a
inner = t1 (t2 m) a -> ComposeT t1 t2 m a
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
t1 (t2 m) a -> ComposeT t1 t2 m a
ComposeT (t1 (t2 m) a -> ComposeT t1 t2 m a)
-> t1 (t2 m) a -> ComposeT t1 t2 m a
forall a b. (a -> b) -> a -> b
$ ((forall x. t1 (t2 m) x -> t2 m x) -> t2 m a) -> t1 (t2 m) a
forall (m :: * -> *) a.
Monad m =>
((forall x. t1 m x -> m x) -> m a) -> t1 m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTransControlIdentity t, Monad m) =>
((forall x. t m x -> m x) -> m a) -> t m a
liftWithIdentity (((forall x. t1 (t2 m) x -> t2 m x) -> t2 m a) -> t1 (t2 m) a)
-> ((forall x. t1 (t2 m) x -> t2 m x) -> t2 m a) -> t1 (t2 m) a
forall a b. (a -> b) -> a -> b
$ \ forall x. t1 (t2 m) x -> t2 m x
runId1 ->
((forall x. t2 m x -> m x) -> m a) -> t2 m a
forall (m :: * -> *) a.
Monad m =>
((forall x. t2 m x -> m x) -> m a) -> t2 m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTransControlIdentity t, Monad m) =>
((forall x. t m x -> m x) -> m a) -> t m a
liftWithIdentity (((forall x. t2 m x -> m x) -> m a) -> t2 m a)
-> ((forall x. t2 m x -> m x) -> m a) -> t2 m a
forall a b. (a -> b) -> a -> b
$ \ forall x. t2 m x -> m x
runId2 -> (forall x. ComposeT t1 t2 m x -> m x) -> m a
inner ((forall x. ComposeT t1 t2 m x -> m x) -> m a)
-> (forall x. ComposeT t1 t2 m x -> m x) -> m a
forall a b. (a -> b) -> a -> b
$ t2 m x -> m x
forall x. t2 m x -> m x
runId2 (t2 m x -> m x)
-> (ComposeT t1 t2 m x -> t2 m x) -> ComposeT t1 t2 m x -> m x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t1 (t2 m) x -> t2 m x
forall x. t1 (t2 m) x -> t2 m x
runId1 (t1 (t2 m) x -> t2 m x)
-> (ComposeT t1 t2 m x -> t1 (t2 m) x)
-> ComposeT t1 t2 m x
-> t2 m x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ComposeT t1 t2 m x -> t1 (t2 m) x
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
ComposeT t1 t2 m a -> t1 (t2 m) a
deComposeT
deriving via Elevator (ComposeT t1 t2) m
instance
( MonadBase b m
, MonadTrans (ComposeT t1 t2)
) => MonadBase b (ComposeT t1 t2 m)
deriving via Elevator (ComposeT t1 t2) m
instance
( MonadBaseControl b m
, MonadTransControl (ComposeT t1 t2)
) => MonadBaseControl b (ComposeT t1 t2 m)
deriving via Elevator (ComposeT t1 t2) m
instance
( MonadBaseControlIdentity b m
, MonadTransControlIdentity (ComposeT t1 t2)
) => MonadBaseControlIdentity b (ComposeT t1 t2 m)
deriving via Elevator t1 (t2 (m :: Type -> Type))
instance {-# OVERLAPPABLE #-}
( Alternative (t2 m)
, Monad (t2 m)
, MonadTransControl t1
) => Alternative (ComposeT t1 t2 m)
deriving via T.ExceptT e (t2 (m :: Type -> Type))
instance
( Monoid e
, Monad (t2 m)
) => Alternative (ComposeT (T.ExceptT e) t2 m)
deriving via T.MaybeT (t2 (m :: Type -> Type))
instance
( Monad (t2 m)
) => Alternative (ComposeT T.MaybeT t2 m)
deriving via Elevator t1 (t2 (m :: Type -> Type))
instance {-# OVERLAPPABLE #-}
( MonadFail (t2 m)
, MonadTrans t1
) => MonadFail (ComposeT t1 t2 m)
deriving via T.MaybeT (t2 (m :: Type -> Type))
instance
( Monad (t2 m)
) => MonadFail (ComposeT T.MaybeT t2 m)
deriving via Elevator t1 (t2 (m :: Type -> Type))
instance {-# OVERLAPPABLE #-}
( MonadFix (t2 m)
, MonadTransControlIdentity t1
) => MonadFix (ComposeT t1 t2 m)
deriving via Elevator (ComposeT t1 t2) m
instance
( MonadIO m
, MonadTrans (ComposeT t1 t2)
) => MonadIO (ComposeT t1 t2 m)
deriving via Elevator t1 (t2 (m :: Type -> Type))
instance {-# OVERLAPPABLE #-}
( MonadPlus (t2 m)
, MonadTransControl t1
) => MonadPlus (ComposeT t1 t2 m)
deriving via T.ExceptT e (t2 (m :: Type -> Type))
instance
( Monoid e
, Monad (t2 m)
) => MonadPlus (ComposeT (T.ExceptT e) t2 m)
deriving via T.MaybeT (t2 (m :: Type -> Type))
instance
( Monad (t2 m)
) => MonadPlus (ComposeT T.MaybeT t2 m)
deriving via Elevator t1 (t2 (m :: Type -> Type))
instance {-# OVERLAPPABLE #-}
( MonadZip (t2 m)
, MonadTransControlIdentity t1
) => MonadZip (ComposeT t1 t2 m)
#if defined(VERSION_exceptions)
deriving via Exceptions.T.CatchT (t2 (m :: Type -> Type))
instance
( Monad (t2 m)
) => Alternative (ComposeT Exceptions.T.CatchT t2 m)
deriving via Exceptions.T.CatchT (t2 (m :: Type -> Type))
instance
( Monad (t2 m)
) => MonadFail (ComposeT Exceptions.T.CatchT t2 m)
deriving via Exceptions.T.CatchT (t2 (m :: Type -> Type))
instance
( Monad (t2 m)
) => MonadPlus (ComposeT Exceptions.T.CatchT t2 m)
deriving via Elevator t1 (t2 (m :: Type -> Type))
instance {-# OVERLAPPABLE #-}
( Exceptions.MonadThrow (t2 m)
, MonadTrans t1
) => Exceptions.MonadThrow (ComposeT t1 t2 m)
deriving via Exceptions.T.CatchT (t2 (m :: Type -> Type))
instance
( Monad (t2 m)
) => Exceptions.MonadThrow (ComposeT Exceptions.T.CatchT t2 m)
deriving via Elevator t1 (t2 (m :: Type -> Type))
instance {-# OVERLAPPABLE #-}
( Exceptions.MonadCatch (t2 m)
, MonadTransControl t1
) => Exceptions.MonadCatch (ComposeT t1 t2 m)
deriving via Exceptions.T.CatchT (t2 (m :: Type -> Type))
instance
( Monad (t2 m)
) => Exceptions.MonadCatch (ComposeT Exceptions.T.CatchT t2 m)
deriving via Elevator t1 (t2 (m :: Type -> Type))
instance {-# OVERLAPPABLE #-}
( Exceptions.MonadMask (t2 m)
, MonadTransControl t1
) => Exceptions.MonadMask (ComposeT t1 t2 m)
deriving via Exceptions.T.CatchT (t2 (m :: Type -> Type))
instance
( Monad (t2 m)
) => Exceptions.MonadMask (ComposeT Exceptions.T.CatchT t2 m)
#endif
#if defined(VERSION_logict)
deriving via LogicT.T.LogicT (t2 (m :: Type -> Type))
instance Alternative (ComposeT LogicT.T.LogicT t2 m)
deriving via LogicT.T.LogicT (t2 (m :: Type -> Type))
instance MonadFail (ComposeT LogicT.T.LogicT t2 m)
deriving via LogicT.T.LogicT (t2 (m :: Type -> Type))
instance MonadPlus (ComposeT LogicT.T.LogicT t2 m)
instance {-# OVERLAPPABLE #-} (LogicT.MonadLogic (t2 m), MonadTransControlIdentity t1) => LogicT.MonadLogic (ComposeT t1 t2 m) where
msplit :: forall a.
ComposeT t1 t2 m a
-> ComposeT t1 t2 m (Maybe (a, ComposeT t1 t2 m a))
msplit = (((\(a
a, Elevator t1 (t2 m) a
b) -> (a
a, t1 (t2 m) a -> ComposeT t1 t2 m a
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
t1 (t2 m) a -> ComposeT t1 t2 m a
ComposeT (t1 (t2 m) a -> ComposeT t1 t2 m a)
-> t1 (t2 m) a -> ComposeT t1 t2 m a
forall a b. (a -> b) -> a -> b
$ Elevator t1 (t2 m) a -> t1 (t2 m) a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
Elevator t m a -> t m a
descend Elevator t1 (t2 m) a
b)) <$>) <$>) (ComposeT t1 t2 m (Maybe (a, Elevator t1 (t2 m) a))
-> ComposeT t1 t2 m (Maybe (a, ComposeT t1 t2 m a)))
-> (ComposeT t1 t2 m a
-> ComposeT t1 t2 m (Maybe (a, Elevator t1 (t2 m) a)))
-> ComposeT t1 t2 m a
-> ComposeT t1 t2 m (Maybe (a, ComposeT t1 t2 m a))
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
t1 (t2 m) (Maybe (a, Elevator t1 (t2 m) a))
-> ComposeT t1 t2 m (Maybe (a, Elevator t1 (t2 m) a))
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
t1 (t2 m) a -> ComposeT t1 t2 m a
ComposeT (t1 (t2 m) (Maybe (a, Elevator t1 (t2 m) a))
-> ComposeT t1 t2 m (Maybe (a, Elevator t1 (t2 m) a)))
-> (ComposeT t1 t2 m a
-> t1 (t2 m) (Maybe (a, Elevator t1 (t2 m) a)))
-> ComposeT t1 t2 m a
-> ComposeT t1 t2 m (Maybe (a, Elevator t1 (t2 m) a))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Elevator t1 (t2 m) (Maybe (a, Elevator t1 (t2 m) a))
-> t1 (t2 m) (Maybe (a, Elevator t1 (t2 m) a))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
Elevator t m a -> t m a
descend (Elevator t1 (t2 m) (Maybe (a, Elevator t1 (t2 m) a))
-> t1 (t2 m) (Maybe (a, Elevator t1 (t2 m) a)))
-> (ComposeT t1 t2 m a
-> Elevator t1 (t2 m) (Maybe (a, Elevator t1 (t2 m) a)))
-> ComposeT t1 t2 m a
-> t1 (t2 m) (Maybe (a, Elevator t1 (t2 m) a))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Elevator t1 (t2 m) a
-> Elevator t1 (t2 m) (Maybe (a, Elevator t1 (t2 m) a))
forall a.
Elevator t1 (t2 m) a
-> Elevator t1 (t2 m) (Maybe (a, Elevator t1 (t2 m) a))
forall (m :: * -> *) a. MonadLogic m => m a -> m (Maybe (a, m a))
LogicT.msplit (Elevator t1 (t2 m) a
-> Elevator t1 (t2 m) (Maybe (a, Elevator t1 (t2 m) a)))
-> (ComposeT t1 t2 m a -> Elevator t1 (t2 m) a)
-> ComposeT t1 t2 m a
-> Elevator t1 (t2 m) (Maybe (a, Elevator t1 (t2 m) a))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t1 (t2 m) a -> Elevator t1 (t2 m) a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
t m a -> Elevator t m a
Ascend (t1 (t2 m) a -> Elevator t1 (t2 m) a)
-> (ComposeT t1 t2 m a -> t1 (t2 m) a)
-> ComposeT t1 t2 m a
-> Elevator t1 (t2 m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ComposeT t1 t2 m a -> t1 (t2 m) a
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
ComposeT t1 t2 m a -> t1 (t2 m) a
deComposeT
deriving via LogicT.T.LogicT (t2 (m :: Type -> Type))
instance
( Monad (t2 m)
) => LogicT.MonadLogic (ComposeT LogicT.T.LogicT t2 m)
#endif
#if defined(VERSION_monad_logger)
deriving via Elevator t1 (t2 (m :: Type -> Type))
instance {-# OVERLAPPABLE #-}
( MonadLogger.MonadLogger (t2 m)
, MonadTrans t1
) => MonadLogger.MonadLogger (ComposeT t1 t2 m)
deriving via MonadLogger.LoggingT (t2 (m :: Type -> Type))
instance
( MonadIO (t2 m)
) => MonadLogger.MonadLogger (ComposeT MonadLogger.LoggingT t2 m)
deriving via MonadLogger.NoLoggingT (t2 (m :: Type -> Type))
instance
( Monad (t2 m)
) => MonadLogger.MonadLogger (ComposeT MonadLogger.NoLoggingT t2 m)
deriving via MonadLogger.WriterLoggingT (t2 (m :: Type -> Type))
instance
( Monad (t2 m)
) => MonadLogger.MonadLogger (ComposeT MonadLogger.WriterLoggingT t2 m)
deriving via Elevator t1 (t2 (m :: Type -> Type))
instance {-# OVERLAPPABLE #-}
( MonadLogger.MonadLoggerIO (t2 m)
, MonadTrans t1
, MonadIO m
, MonadTrans t2
) => MonadLogger.MonadLoggerIO (ComposeT t1 t2 m)
deriving via MonadLogger.LoggingT (t2 (m :: Type -> Type))
instance
( MonadIO (t2 m)
, MonadIO m
, MonadTrans t2
) => MonadLogger.MonadLoggerIO (ComposeT MonadLogger.LoggingT t2 m)
deriving via MonadLogger.NoLoggingT (t2 (m :: Type -> Type))
instance
( MonadIO (t2 m)
, MonadIO m
, MonadTrans t2
) => MonadLogger.MonadLoggerIO (ComposeT MonadLogger.NoLoggingT t2 m)
#endif
#if defined(VERSION_mtl)
deriving via Elevator t1 (t2 (m :: Type -> Type))
instance {-# OVERLAPPABLE #-}
( Mtl.MonadAccum w (t2 m)
, MonadTrans t1
) => Mtl.MonadAccum w (ComposeT t1 t2 m)
deriving via Mtl.T.AccumT w (t2 (m :: Type -> Type))
instance
( Monoid w
, Monad (t2 m)
) => Mtl.MonadAccum w (ComposeT (Mtl.T.AccumT w) t2 m)
deriving via Elevator t1 (t2 (m :: Type -> Type))
instance {-# OVERLAPPABLE #-}
( Mtl.MonadCont (t2 m)
, MonadTransControl t1
) => Mtl.MonadCont (ComposeT t1 t2 m)
deriving via Mtl.T.ContT (r :: Type) (t2 (m :: Type -> Type))
instance Mtl.MonadCont (ComposeT (Mtl.T.ContT r) t2 m)
deriving via Elevator t1 (t2 (m :: Type -> Type))
instance {-# OVERLAPPABLE #-}
( Mtl.MonadError e (t2 m)
, MonadTransControl t1
) => Mtl.MonadError e (ComposeT t1 t2 m)
deriving via Mtl.T.ExceptT e (t2 (m :: Type -> Type))
instance
( Monad (t2 m)
) => Mtl.MonadError e (ComposeT (Mtl.T.ExceptT e) t2 m)
deriving via Elevator t1 (t2 (m :: Type -> Type))
instance {-# OVERLAPPABLE #-}
( Mtl.MonadReader r (t2 m)
, MonadTransControl t1
) => Mtl.MonadReader r (ComposeT t1 t2 m)
deriving via Mtl.T.ReaderT r (t2 (m :: Type -> Type))
instance
( Monad (t2 m)
) => Mtl.MonadReader r (ComposeT (Mtl.T.ReaderT r) t2 m)
deriving via Mtl.CPST.RWST r w s (t2 (m :: Type -> Type))
instance
( Monoid w
, Monad (t2 m)
) => Mtl.MonadReader r (ComposeT (Mtl.CPST.RWST r w s) t2 m)
deriving via Mtl.LT.RWST r w s (t2 (m :: Type -> Type))
instance
( Monoid w
, Monad (t2 m)
) => Mtl.MonadReader r (ComposeT (Mtl.LT.RWST r w s) t2 m)
deriving via Mtl.ST.RWST r w s (t2 (m :: Type -> Type))
instance
( Monoid w
, Monad (t2 m)
) => Mtl.MonadReader r (ComposeT (Mtl.ST.RWST r w s) t2 m)
deriving via Elevator t1 (t2 (m :: Type -> Type))
instance {-# OVERLAPPABLE #-}
( Mtl.MonadRWS r w s (t2 m)
, MonadTransControl t1
) => Mtl.MonadRWS r w s (ComposeT t1 t2 m)
deriving via Mtl.CPST.RWST r w s (t2 (m :: Type -> Type))
instance
( Monoid w
, Monad (t2 m)
) => Mtl.MonadRWS r w s (ComposeT (Mtl.CPST.RWST r w s) t2 m)
deriving via Mtl.LT.RWST r w s (t2 (m :: Type -> Type))
instance
( Monoid w
, Monad (t2 m)
) => Mtl.MonadRWS r w s (ComposeT (Mtl.LT.RWST r w s) t2 m)
deriving via Mtl.ST.RWST r w s (t2 (m :: Type -> Type))
instance
( Monoid w
, Monad (t2 m)
) => Mtl.MonadRWS r w s (ComposeT (Mtl.ST.RWST r w s) t2 m)
deriving via Elevator t1 (t2 (m :: Type -> Type))
instance {-# OVERLAPPABLE #-}
( Mtl.MonadSelect r (t2 m)
, MonadTrans t1
) => Mtl.MonadSelect r (ComposeT t1 t2 m)
deriving via Mtl.T.SelectT r (t2 (m :: Type -> Type))
instance
( MonadBaseControlIdentity Mtl.Identity (t2 m)
) => Mtl.MonadSelect r (ComposeT (Mtl.T.SelectT r) t2 m)
deriving via Elevator t1 (t2 (m :: Type -> Type))
instance {-# OVERLAPPABLE #-}
( Mtl.MonadState s (t2 m)
, MonadTrans t1
) => Mtl.MonadState s (ComposeT t1 t2 m)
deriving via Mtl.LT.StateT s (t2 (m :: Type -> Type))
instance
( Monad (t2 m)
) => Mtl.MonadState s (ComposeT (Mtl.LT.StateT s) t2 m)
deriving via Mtl.ST.StateT s (t2 (m :: Type -> Type))
instance
( Monad (t2 m)
) => Mtl.MonadState s (ComposeT (Mtl.ST.StateT s) t2 m)
deriving via Mtl.CPST.RWST r w s (t2 (m :: Type -> Type))
instance
( Monoid w
, Monad (t2 m)
) => Mtl.MonadState s (ComposeT (Mtl.CPST.RWST r w s) t2 m)
deriving via Mtl.LT.RWST r w s (t2 (m :: Type -> Type))
instance
( Monoid w
, Monad (t2 m)
) => Mtl.MonadState s (ComposeT (Mtl.LT.RWST r w s) t2 m)
deriving via Mtl.ST.RWST r w s (t2 (m :: Type -> Type))
instance
( Monoid w
, Monad (t2 m)
) => Mtl.MonadState s (ComposeT (Mtl.ST.RWST r w s) t2 m)
deriving via Elevator t1 (t2 (m :: Type -> Type))
instance {-# OVERLAPPABLE #-}
( Mtl.MonadWriter w (t2 m)
, MonadTransControl t1
) => Mtl.MonadWriter w (ComposeT t1 t2 m)
deriving via Mtl.CPST.WriterT w (t2 (m :: Type -> Type))
instance
( Monoid w
, Monad (t2 m)
) => Mtl.MonadWriter w (ComposeT (Mtl.CPST.WriterT w) t2 m)
deriving via Mtl.LT.WriterT w (t2 (m :: Type -> Type))
instance
( Monoid w
, Monad (t2 m)
) => Mtl.MonadWriter w (ComposeT (Mtl.LT.WriterT w) t2 m)
deriving via Mtl.ST.WriterT w (t2 (m :: Type -> Type))
instance
( Monoid w
, Monad (t2 m)
) => Mtl.MonadWriter w (ComposeT (Mtl.ST.WriterT w) t2 m)
deriving via Mtl.CPST.RWST r w s (t2 (m :: Type -> Type))
instance
( Monoid w
, Monad (t2 m)
) => Mtl.MonadWriter w (ComposeT (Mtl.CPST.RWST r w s) t2 m)
deriving via Mtl.LT.RWST r w s (t2 (m :: Type -> Type))
instance
( Monoid w
, Monad (t2 m)
) => Mtl.MonadWriter w (ComposeT (Mtl.LT.RWST r w s) t2 m)
deriving via Mtl.ST.RWST r w s (t2 (m :: Type -> Type))
instance
( Monoid w
, Monad (t2 m)
) => Mtl.MonadWriter w (ComposeT (Mtl.ST.RWST r w s) t2 m)
#endif
#if defined(VERSION_primitive)
deriving via Elevator (ComposeT t1 t2) m
instance
( Primitive.PrimMonad m
, MonadTrans (ComposeT t1 t2)
) =>
Primitive.PrimMonad (ComposeT t1 t2 m)
#endif
#if defined(VERSION_random)
instance {-# OVERLAPPABLE #-} (Random.StatefulGen g (t2 m), MonadTrans t1) => Random.StatefulGen (Random.Const g (ComposeT t1 t2)) (ComposeT t1 t2 m) where
uniformWord32R :: Word32 -> Const g (ComposeT t1 t2) -> ComposeT t1 t2 m Word32
uniformWord32R Word32
word32 = t1 (t2 m) Word32 -> ComposeT t1 t2 m Word32
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
t1 (t2 m) a -> ComposeT t1 t2 m a
ComposeT (t1 (t2 m) Word32 -> ComposeT t1 t2 m Word32)
-> (Const g (ComposeT t1 t2) -> t1 (t2 m) Word32)
-> Const g (ComposeT t1 t2)
-> ComposeT t1 t2 m Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t2 m Word32 -> t1 (t2 m) Word32
forall (m :: * -> *) a. Monad m => m a -> t1 m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (t2 m Word32 -> t1 (t2 m) Word32)
-> (Const g (ComposeT t1 t2) -> t2 m Word32)
-> Const g (ComposeT t1 t2)
-> t1 (t2 m) Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> g -> t2 m Word32
forall g (m :: * -> *). StatefulGen g m => Word32 -> g -> m Word32
Random.uniformWord32R Word32
word32 (g -> t2 m Word32)
-> (Const g (ComposeT t1 t2) -> g)
-> Const g (ComposeT t1 t2)
-> t2 m Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Const g (ComposeT t1 t2) -> g
forall {k} a (b :: k). Const a b -> a
Random.getConst
uniformWord64R :: Word64 -> Const g (ComposeT t1 t2) -> ComposeT t1 t2 m Word64
uniformWord64R Word64
word64 = t1 (t2 m) Word64 -> ComposeT t1 t2 m Word64
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
t1 (t2 m) a -> ComposeT t1 t2 m a
ComposeT (t1 (t2 m) Word64 -> ComposeT t1 t2 m Word64)
-> (Const g (ComposeT t1 t2) -> t1 (t2 m) Word64)
-> Const g (ComposeT t1 t2)
-> ComposeT t1 t2 m Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t2 m Word64 -> t1 (t2 m) Word64
forall (m :: * -> *) a. Monad m => m a -> t1 m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (t2 m Word64 -> t1 (t2 m) Word64)
-> (Const g (ComposeT t1 t2) -> t2 m Word64)
-> Const g (ComposeT t1 t2)
-> t1 (t2 m) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> g -> t2 m Word64
forall g (m :: * -> *). StatefulGen g m => Word64 -> g -> m Word64
Random.uniformWord64R Word64
word64 (g -> t2 m Word64)
-> (Const g (ComposeT t1 t2) -> g)
-> Const g (ComposeT t1 t2)
-> t2 m Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Const g (ComposeT t1 t2) -> g
forall {k} a (b :: k). Const a b -> a
Random.getConst
uniformWord8 :: Const g (ComposeT t1 t2) -> ComposeT t1 t2 m Word8
uniformWord8 = t1 (t2 m) Word8 -> ComposeT t1 t2 m Word8
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
t1 (t2 m) a -> ComposeT t1 t2 m a
ComposeT (t1 (t2 m) Word8 -> ComposeT t1 t2 m Word8)
-> (Const g (ComposeT t1 t2) -> t1 (t2 m) Word8)
-> Const g (ComposeT t1 t2)
-> ComposeT t1 t2 m Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t2 m Word8 -> t1 (t2 m) Word8
forall (m :: * -> *) a. Monad m => m a -> t1 m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (t2 m Word8 -> t1 (t2 m) Word8)
-> (Const g (ComposeT t1 t2) -> t2 m Word8)
-> Const g (ComposeT t1 t2)
-> t1 (t2 m) Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. g -> t2 m Word8
forall g (m :: * -> *). StatefulGen g m => g -> m Word8
Random.uniformWord8 (g -> t2 m Word8)
-> (Const g (ComposeT t1 t2) -> g)
-> Const g (ComposeT t1 t2)
-> t2 m Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Const g (ComposeT t1 t2) -> g
forall {k} a (b :: k). Const a b -> a
Random.getConst
uniformWord16 :: Const g (ComposeT t1 t2) -> ComposeT t1 t2 m Word16
uniformWord16 = t1 (t2 m) Word16 -> ComposeT t1 t2 m Word16
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
t1 (t2 m) a -> ComposeT t1 t2 m a
ComposeT (t1 (t2 m) Word16 -> ComposeT t1 t2 m Word16)
-> (Const g (ComposeT t1 t2) -> t1 (t2 m) Word16)
-> Const g (ComposeT t1 t2)
-> ComposeT t1 t2 m Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t2 m Word16 -> t1 (t2 m) Word16
forall (m :: * -> *) a. Monad m => m a -> t1 m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (t2 m Word16 -> t1 (t2 m) Word16)
-> (Const g (ComposeT t1 t2) -> t2 m Word16)
-> Const g (ComposeT t1 t2)
-> t1 (t2 m) Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. g -> t2 m Word16
forall g (m :: * -> *). StatefulGen g m => g -> m Word16
Random.uniformWord16 (g -> t2 m Word16)
-> (Const g (ComposeT t1 t2) -> g)
-> Const g (ComposeT t1 t2)
-> t2 m Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Const g (ComposeT t1 t2) -> g
forall {k} a (b :: k). Const a b -> a
Random.getConst
uniformWord32 :: Const g (ComposeT t1 t2) -> ComposeT t1 t2 m Word32
uniformWord32 = t1 (t2 m) Word32 -> ComposeT t1 t2 m Word32
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
t1 (t2 m) a -> ComposeT t1 t2 m a
ComposeT (t1 (t2 m) Word32 -> ComposeT t1 t2 m Word32)
-> (Const g (ComposeT t1 t2) -> t1 (t2 m) Word32)
-> Const g (ComposeT t1 t2)
-> ComposeT t1 t2 m Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t2 m Word32 -> t1 (t2 m) Word32
forall (m :: * -> *) a. Monad m => m a -> t1 m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (t2 m Word32 -> t1 (t2 m) Word32)
-> (Const g (ComposeT t1 t2) -> t2 m Word32)
-> Const g (ComposeT t1 t2)
-> t1 (t2 m) Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. g -> t2 m Word32
forall g (m :: * -> *). StatefulGen g m => g -> m Word32
Random.uniformWord32 (g -> t2 m Word32)
-> (Const g (ComposeT t1 t2) -> g)
-> Const g (ComposeT t1 t2)
-> t2 m Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Const g (ComposeT t1 t2) -> g
forall {k} a (b :: k). Const a b -> a
Random.getConst
uniformWord64 :: Const g (ComposeT t1 t2) -> ComposeT t1 t2 m Word64
uniformWord64 = t1 (t2 m) Word64 -> ComposeT t1 t2 m Word64
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
t1 (t2 m) a -> ComposeT t1 t2 m a
ComposeT (t1 (t2 m) Word64 -> ComposeT t1 t2 m Word64)
-> (Const g (ComposeT t1 t2) -> t1 (t2 m) Word64)
-> Const g (ComposeT t1 t2)
-> ComposeT t1 t2 m Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t2 m Word64 -> t1 (t2 m) Word64
forall (m :: * -> *) a. Monad m => m a -> t1 m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (t2 m Word64 -> t1 (t2 m) Word64)
-> (Const g (ComposeT t1 t2) -> t2 m Word64)
-> Const g (ComposeT t1 t2)
-> t1 (t2 m) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. g -> t2 m Word64
forall g (m :: * -> *). StatefulGen g m => g -> m Word64
Random.uniformWord64 (g -> t2 m Word64)
-> (Const g (ComposeT t1 t2) -> g)
-> Const g (ComposeT t1 t2)
-> t2 m Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Const g (ComposeT t1 t2) -> g
forall {k} a (b :: k). Const a b -> a
Random.getConst
uniformShortByteString :: Int -> Const g (ComposeT t1 t2) -> ComposeT t1 t2 m ShortByteString
uniformShortByteString Int
n = t1 (t2 m) ShortByteString -> ComposeT t1 t2 m ShortByteString
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
t1 (t2 m) a -> ComposeT t1 t2 m a
ComposeT (t1 (t2 m) ShortByteString -> ComposeT t1 t2 m ShortByteString)
-> (Const g (ComposeT t1 t2) -> t1 (t2 m) ShortByteString)
-> Const g (ComposeT t1 t2)
-> ComposeT t1 t2 m ShortByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t2 m ShortByteString -> t1 (t2 m) ShortByteString
forall (m :: * -> *) a. Monad m => m a -> t1 m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (t2 m ShortByteString -> t1 (t2 m) ShortByteString)
-> (Const g (ComposeT t1 t2) -> t2 m ShortByteString)
-> Const g (ComposeT t1 t2)
-> t1 (t2 m) ShortByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> g -> t2 m ShortByteString
forall g (m :: * -> *).
StatefulGen g m =>
Int -> g -> m ShortByteString
Random.uniformShortByteString Int
n (g -> t2 m ShortByteString)
-> (Const g (ComposeT t1 t2) -> g)
-> Const g (ComposeT t1 t2)
-> t2 m ShortByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Const g (ComposeT t1 t2) -> g
forall {k} a (b :: k). Const a b -> a
Random.getConst
instance {-# OVERLAPPABLE #-} (Random.FrozenGen f (t2 m), MonadTrans t1) => Random.FrozenGen (Random.Const f (ComposeT t1 t2)) (ComposeT t1 t2 m) where
type MutableGen (Random.Const f (ComposeT t1 t2)) (ComposeT t1 t2 m) = Random.Const (Random.MutableGen f (t2 m)) (ComposeT t1 t2)
freezeGen :: MutableGen (Const f (ComposeT t1 t2)) (ComposeT t1 t2 m)
-> ComposeT t1 t2 m (Const f (ComposeT t1 t2))
freezeGen = t1 (t2 m) (Const f (ComposeT t1 t2))
-> ComposeT t1 t2 m (Const f (ComposeT t1 t2))
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
t1 (t2 m) a -> ComposeT t1 t2 m a
ComposeT (t1 (t2 m) (Const f (ComposeT t1 t2))
-> ComposeT t1 t2 m (Const f (ComposeT t1 t2)))
-> (Const (MutableGen f (t2 m)) (ComposeT t1 t2)
-> t1 (t2 m) (Const f (ComposeT t1 t2)))
-> Const (MutableGen f (t2 m)) (ComposeT t1 t2)
-> ComposeT t1 t2 m (Const f (ComposeT t1 t2))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t2 m (Const f (ComposeT t1 t2))
-> t1 (t2 m) (Const f (ComposeT t1 t2))
forall (m :: * -> *) a. Monad m => m a -> t1 m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (t2 m (Const f (ComposeT t1 t2))
-> t1 (t2 m) (Const f (ComposeT t1 t2)))
-> (Const (MutableGen f (t2 m)) (ComposeT t1 t2)
-> t2 m (Const f (ComposeT t1 t2)))
-> Const (MutableGen f (t2 m)) (ComposeT t1 t2)
-> t1 (t2 m) (Const f (ComposeT t1 t2))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (f -> Const f (ComposeT t1 t2))
-> t2 m f -> t2 m (Const f (ComposeT t1 t2))
forall a b. (a -> b) -> t2 m a -> t2 m b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap f -> Const f (ComposeT t1 t2)
forall {k} a (b :: k). a -> Const a b
Random.Const (t2 m f -> t2 m (Const f (ComposeT t1 t2)))
-> (Const (MutableGen f (t2 m)) (ComposeT t1 t2) -> t2 m f)
-> Const (MutableGen f (t2 m)) (ComposeT t1 t2)
-> t2 m (Const f (ComposeT t1 t2))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MutableGen f (t2 m) -> t2 m f
forall f (m :: * -> *). FrozenGen f m => MutableGen f m -> m f
Random.freezeGen (MutableGen f (t2 m) -> t2 m f)
-> (Const (MutableGen f (t2 m)) (ComposeT t1 t2)
-> MutableGen f (t2 m))
-> Const (MutableGen f (t2 m)) (ComposeT t1 t2)
-> t2 m f
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Const (MutableGen f (t2 m)) (ComposeT t1 t2) -> MutableGen f (t2 m)
forall {k} a (b :: k). Const a b -> a
Random.getConst
thawGen :: Const f (ComposeT t1 t2)
-> ComposeT
t1 t2 m (MutableGen (Const f (ComposeT t1 t2)) (ComposeT t1 t2 m))
thawGen = t1 (t2 m) (Const (MutableGen f (t2 m)) (ComposeT t1 t2))
-> ComposeT t1 t2 m (Const (MutableGen f (t2 m)) (ComposeT t1 t2))
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
t1 (t2 m) a -> ComposeT t1 t2 m a
ComposeT (t1 (t2 m) (Const (MutableGen f (t2 m)) (ComposeT t1 t2))
-> ComposeT t1 t2 m (Const (MutableGen f (t2 m)) (ComposeT t1 t2)))
-> (Const f (ComposeT t1 t2)
-> t1 (t2 m) (Const (MutableGen f (t2 m)) (ComposeT t1 t2)))
-> Const f (ComposeT t1 t2)
-> ComposeT t1 t2 m (Const (MutableGen f (t2 m)) (ComposeT t1 t2))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t2 m (Const (MutableGen f (t2 m)) (ComposeT t1 t2))
-> t1 (t2 m) (Const (MutableGen f (t2 m)) (ComposeT t1 t2))
forall (m :: * -> *) a. Monad m => m a -> t1 m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (t2 m (Const (MutableGen f (t2 m)) (ComposeT t1 t2))
-> t1 (t2 m) (Const (MutableGen f (t2 m)) (ComposeT t1 t2)))
-> (Const f (ComposeT t1 t2)
-> t2 m (Const (MutableGen f (t2 m)) (ComposeT t1 t2)))
-> Const f (ComposeT t1 t2)
-> t1 (t2 m) (Const (MutableGen f (t2 m)) (ComposeT t1 t2))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (MutableGen f (t2 m)
-> Const (MutableGen f (t2 m)) (ComposeT t1 t2))
-> t2 m (MutableGen f (t2 m))
-> t2 m (Const (MutableGen f (t2 m)) (ComposeT t1 t2))
forall a b. (a -> b) -> t2 m a -> t2 m b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap MutableGen f (t2 m) -> Const (MutableGen f (t2 m)) (ComposeT t1 t2)
forall {k} a (b :: k). a -> Const a b
Random.Const (t2 m (MutableGen f (t2 m))
-> t2 m (Const (MutableGen f (t2 m)) (ComposeT t1 t2)))
-> (Const f (ComposeT t1 t2) -> t2 m (MutableGen f (t2 m)))
-> Const f (ComposeT t1 t2)
-> t2 m (Const (MutableGen f (t2 m)) (ComposeT t1 t2))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. f -> t2 m (MutableGen f (t2 m))
forall f (m :: * -> *). FrozenGen f m => f -> m (MutableGen f m)
Random.thawGen (f -> t2 m (MutableGen f (t2 m)))
-> (Const f (ComposeT t1 t2) -> f)
-> Const f (ComposeT t1 t2)
-> t2 m (MutableGen f (t2 m))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Const f (ComposeT t1 t2) -> f
forall {k} a (b :: k). Const a b -> a
Random.getConst
instance {-# OVERLAPPABLE #-} (Random.RandomGenM g r (t2 m), MonadTrans t1) => Random.RandomGenM (Random.Const g (ComposeT t1 t2)) r (ComposeT t1 t2 m) where
applyRandomGenM :: forall a.
(r -> (a, r)) -> Const g (ComposeT t1 t2) -> ComposeT t1 t2 m a
applyRandomGenM r -> (a, r)
f = t1 (t2 m) a -> ComposeT t1 t2 m a
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
t1 (t2 m) a -> ComposeT t1 t2 m a
ComposeT (t1 (t2 m) a -> ComposeT t1 t2 m a)
-> (Const g (ComposeT t1 t2) -> t1 (t2 m) a)
-> Const g (ComposeT t1 t2)
-> ComposeT t1 t2 m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t2 m a -> t1 (t2 m) a
forall (m :: * -> *) a. Monad m => m a -> t1 m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (t2 m a -> t1 (t2 m) a)
-> (Const g (ComposeT t1 t2) -> t2 m a)
-> Const g (ComposeT t1 t2)
-> t1 (t2 m) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (r -> (a, r)) -> g -> t2 m a
forall a. (r -> (a, r)) -> g -> t2 m a
forall g r (m :: * -> *) a.
RandomGenM g r m =>
(r -> (a, r)) -> g -> m a
Random.applyRandomGenM r -> (a, r)
f (g -> t2 m a)
-> (Const g (ComposeT t1 t2) -> g)
-> Const g (ComposeT t1 t2)
-> t2 m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Const g (ComposeT t1 t2) -> g
forall {k} a (b :: k). Const a b -> a
Random.getConst
#endif
#if defined(VERSION_resourcet)
deriving via Elevator t1 (t2 (m :: Type -> Type))
instance {-# OVERLAPPABLE #-}
( ResourceT.MonadResource (t2 m)
, MonadTrans t1
, MonadIO m
, MonadTrans t2
) => ResourceT.MonadResource (ComposeT t1 t2 m)
deriving via ResourceT.ResourceT (t2 (m :: Type -> Type))
instance
( MonadIO (t2 m)
, MonadIO m
, MonadTrans t2
) => ResourceT.MonadResource (ComposeT ResourceT.ResourceT t2 m)
#endif
#if defined(VERSION_unliftio_core)
deriving via Elevator (ComposeT t1 t2) m
instance
( UnliftIO.MonadUnliftIO m
, MonadTransControlIdentity (ComposeT t1 t2)
) =>
UnliftIO.MonadUnliftIO (ComposeT t1 t2 m)
#endif
runComposeT :: (forall a. t1 (t2 m) a -> t2 m (StT t1 a))
-> (forall a. t2 m a -> m (StT t2 a))
-> (forall a. ComposeT t1 t2 m a -> m (StT t2 (StT t1 a)))
runComposeT :: forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *).
(forall a. t1 (t2 m) a -> t2 m (StT t1 a))
-> (forall a. t2 m a -> m (StT t2 a))
-> forall a. ComposeT t1 t2 m a -> m (StT t2 (StT t1 a))
runComposeT forall a. t1 (t2 m) a -> t2 m (StT t1 a)
runT1 forall a. t2 m a -> m (StT t2 a)
runT2 = t2 m (StT t1 a) -> m (StT t2 (StT t1 a))
forall a. t2 m a -> m (StT t2 a)
runT2 (t2 m (StT t1 a) -> m (StT t2 (StT t1 a)))
-> (ComposeT t1 t2 m a -> t2 m (StT t1 a))
-> ComposeT t1 t2 m a
-> m (StT t2 (StT t1 a))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t1 (t2 m) a -> t2 m (StT t1 a)
forall a. t1 (t2 m) a -> t2 m (StT t1 a)
runT1 (t1 (t2 m) a -> t2 m (StT t1 a))
-> (ComposeT t1 t2 m a -> t1 (t2 m) a)
-> ComposeT t1 t2 m a
-> t2 m (StT t1 a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ComposeT t1 t2 m a -> t1 (t2 m) a
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
ComposeT t1 t2 m a -> t1 (t2 m) a
deComposeT
runComposeT' :: (t1 (t2 m) a -> t2 m a)
-> (t2 m a -> m a)
-> (ComposeT t1 t2 m a -> m a)
runComposeT' :: forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
(t1 (t2 m) a -> t2 m a)
-> (t2 m a -> m a) -> ComposeT t1 t2 m a -> m a
runComposeT' t1 (t2 m) a -> t2 m a
runT1 t2 m a -> m a
runT2 = t2 m a -> m a
runT2 (t2 m a -> m a)
-> (ComposeT t1 t2 m a -> t2 m a) -> ComposeT t1 t2 m a -> m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t1 (t2 m) a -> t2 m a
runT1 (t1 (t2 m) a -> t2 m a)
-> (ComposeT t1 t2 m a -> t1 (t2 m) a)
-> ComposeT t1 t2 m a
-> t2 m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ComposeT t1 t2 m a -> t1 (t2 m) a
forall (t1 :: (* -> *) -> * -> *) (t2 :: (* -> *) -> * -> *)
(m :: * -> *) a.
ComposeT t1 t2 m a -> t1 (t2 m) a
deComposeT