{-# LANGUAGE DerivingVia #-}
{-# OPTIONS_HADDOCK not-home #-}
module Control.Effect.Internal where
import Data.Coerce
import Data.Kind (Constraint)
import Data.Functor.Identity
import Data.Monoid
import Control.Monad.Trans
import Control.Monad.Trans.Identity
import Control.Effect.Internal.Membership
import Control.Effect.Internal.Union
import Control.Effect.Internal.Utils
import Control.Effect.Internal.Derive
import Control.Effect.Internal.Itself
class Monad m => Carrier m where
type Derivs m :: [Effect]
type Prims m :: [Effect]
algPrims :: Algebra' (Prims m) m a
reformulate :: Monad z
=> Reformulation' (Derivs m) (Prims m) m z a
algDerivs :: Algebra' (Derivs m) m a
algDerivs = Reformulation' (Derivs m) (Prims m) m m a
forall (m :: * -> *) (z :: * -> *) a.
(Carrier m, Monad z) =>
Reformulation' (Derivs m) (Prims m) m z a
reformulate forall a. a -> a
forall x. m x -> m x
id forall x. Algebra' (Prims m) m x
forall (m :: * -> *) x. Carrier m => Algebra' (Prims m) m x
algPrims
{-# INLINE algDerivs #-}
deriving newtype instance Carrier m => Carrier (Alt m)
deriving newtype instance Carrier m => Carrier (Ap m)
type Eff e m = Effs '[e] m
type Effs es m = (EffMembers es (Derivs m), Carrier m)
send :: (Member e (Derivs m), Carrier m) => e m a -> m a
send :: e m a -> m a
send = Union (Derivs m) m a -> m a
forall (m :: * -> *) a. Carrier m => Algebra' (Derivs m) m a
algDerivs (Union (Derivs m) m a -> m a)
-> (e m a -> Union (Derivs m) m a) -> e m a -> m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. e m a -> Union (Derivs m) m a
forall (e :: (* -> *) -> * -> *) (r :: [(* -> *) -> * -> *])
(m :: * -> *) a.
Member e r =>
e m a -> Union r m a
inj
{-# INLINE send #-}
deriving via (m :: * -> *) instance Carrier m => Carrier (IdentityT m)
type Threaders cs m p = (p ~ Prims m, SatisfiesAll p cs)
type family SatisfiesAll (q :: k) cs :: Constraint where
SatisfiesAll q '[] = ()
SatisfiesAll q (c ': cs) = (c q, SatisfiesAll q cs)
type RunC = Identity
run :: RunC a -> a
run :: RunC a -> a
run = RunC a -> a
forall a. Identity a -> a
runIdentity
{-# INLINE run #-}
instance Carrier Identity where
type Derivs Identity = '[]
type Prims Identity = '[]
algPrims :: Algebra' (Prims Identity) Identity a
algPrims = Algebra' (Prims Identity) Identity a
forall (m :: * -> *) a b. Union '[] m a -> b
absurdU
{-# INLINE algPrims #-}
reformulate :: Reformulation' (Derivs Identity) (Prims Identity) Identity z a
reformulate forall x. Identity x -> z x
_ Algebra (Prims Identity) z
_ = Union (Derivs Identity) z a -> z a
forall (m :: * -> *) a b. Union '[] m a -> b
absurdU
{-# INLINE reformulate #-}
algDerivs :: Algebra' (Derivs Identity) Identity a
algDerivs = Algebra' (Derivs Identity) Identity a
forall (m :: * -> *) a b. Union '[] m a -> b
absurdU
{-# INLINE algDerivs #-}
deriving newtype instance Carrier m => Carrier (Itself m)
newtype SubsumeC (e :: Effect) m a = SubsumeC {
SubsumeC e m a -> m a
unSubsumeC :: m a
}
deriving ( a -> SubsumeC e m b -> SubsumeC e m a
(a -> b) -> SubsumeC e m a -> SubsumeC e m b
(forall a b. (a -> b) -> SubsumeC e m a -> SubsumeC e m b)
-> (forall a b. a -> SubsumeC e m b -> SubsumeC e m a)
-> Functor (SubsumeC e m)
forall a b. a -> SubsumeC e m b -> SubsumeC e m a
forall a b. (a -> b) -> SubsumeC e m a -> SubsumeC e m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a b.
Functor m =>
a -> SubsumeC e m b -> SubsumeC e m a
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a b.
Functor m =>
(a -> b) -> SubsumeC e m a -> SubsumeC e m b
<$ :: a -> SubsumeC e m b -> SubsumeC e m a
$c<$ :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a b.
Functor m =>
a -> SubsumeC e m b -> SubsumeC e m a
fmap :: (a -> b) -> SubsumeC e m a -> SubsumeC e m b
$cfmap :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a b.
Functor m =>
(a -> b) -> SubsumeC e m a -> SubsumeC e m b
Functor, Functor (SubsumeC e m)
a -> SubsumeC e m a
Functor (SubsumeC e m)
-> (forall a. a -> SubsumeC e m a)
-> (forall a b.
SubsumeC e m (a -> b) -> SubsumeC e m a -> SubsumeC e m b)
-> (forall a b c.
(a -> b -> c)
-> SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m c)
-> (forall a b. SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m b)
-> (forall a b. SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m a)
-> Applicative (SubsumeC e m)
SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m b
SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m a
SubsumeC e m (a -> b) -> SubsumeC e m a -> SubsumeC e m b
(a -> b -> c) -> SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m c
forall a. a -> SubsumeC e m a
forall a b. SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m a
forall a b. SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m b
forall a b.
SubsumeC e m (a -> b) -> SubsumeC e m a -> SubsumeC e m b
forall a b c.
(a -> b -> c) -> SubsumeC e m a -> SubsumeC e m b -> SubsumeC e 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 (e :: (* -> *) -> * -> *) (m :: * -> *).
Applicative m =>
Functor (SubsumeC e m)
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
Applicative m =>
a -> SubsumeC e m a
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a b.
Applicative m =>
SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m a
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a b.
Applicative m =>
SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m b
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a b.
Applicative m =>
SubsumeC e m (a -> b) -> SubsumeC e m a -> SubsumeC e m b
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c) -> SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m c
<* :: SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m a
$c<* :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a b.
Applicative m =>
SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m a
*> :: SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m b
$c*> :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a b.
Applicative m =>
SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m b
liftA2 :: (a -> b -> c) -> SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m c
$cliftA2 :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c) -> SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m c
<*> :: SubsumeC e m (a -> b) -> SubsumeC e m a -> SubsumeC e m b
$c<*> :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a b.
Applicative m =>
SubsumeC e m (a -> b) -> SubsumeC e m a -> SubsumeC e m b
pure :: a -> SubsumeC e m a
$cpure :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
Applicative m =>
a -> SubsumeC e m a
$cp1Applicative :: forall (e :: (* -> *) -> * -> *) (m :: * -> *).
Applicative m =>
Functor (SubsumeC e m)
Applicative, Applicative (SubsumeC e m)
a -> SubsumeC e m a
Applicative (SubsumeC e m)
-> (forall a b.
SubsumeC e m a -> (a -> SubsumeC e m b) -> SubsumeC e m b)
-> (forall a b. SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m b)
-> (forall a. a -> SubsumeC e m a)
-> Monad (SubsumeC e m)
SubsumeC e m a -> (a -> SubsumeC e m b) -> SubsumeC e m b
SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m b
forall a. a -> SubsumeC e m a
forall a b. SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m b
forall a b.
SubsumeC e m a -> (a -> SubsumeC e m b) -> SubsumeC e 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 (e :: (* -> *) -> * -> *) (m :: * -> *).
Monad m =>
Applicative (SubsumeC e m)
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
Monad m =>
a -> SubsumeC e m a
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a b.
Monad m =>
SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m b
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a b.
Monad m =>
SubsumeC e m a -> (a -> SubsumeC e m b) -> SubsumeC e m b
return :: a -> SubsumeC e m a
$creturn :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
Monad m =>
a -> SubsumeC e m a
>> :: SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m b
$c>> :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a b.
Monad m =>
SubsumeC e m a -> SubsumeC e m b -> SubsumeC e m b
>>= :: SubsumeC e m a -> (a -> SubsumeC e m b) -> SubsumeC e m b
$c>>= :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a b.
Monad m =>
SubsumeC e m a -> (a -> SubsumeC e m b) -> SubsumeC e m b
$cp1Monad :: forall (e :: (* -> *) -> * -> *) (m :: * -> *).
Monad m =>
Applicative (SubsumeC e m)
Monad
, Applicative (SubsumeC e m)
SubsumeC e m a
Applicative (SubsumeC e m)
-> (forall a. SubsumeC e m a)
-> (forall a. SubsumeC e m a -> SubsumeC e m a -> SubsumeC e m a)
-> (forall a. SubsumeC e m a -> SubsumeC e m [a])
-> (forall a. SubsumeC e m a -> SubsumeC e m [a])
-> Alternative (SubsumeC e m)
SubsumeC e m a -> SubsumeC e m a -> SubsumeC e m a
SubsumeC e m a -> SubsumeC e m [a]
SubsumeC e m a -> SubsumeC e m [a]
forall a. SubsumeC e m a
forall a. SubsumeC e m a -> SubsumeC e m [a]
forall a. SubsumeC e m a -> SubsumeC e m a -> SubsumeC e 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 (e :: (* -> *) -> * -> *) (m :: * -> *).
Alternative m =>
Applicative (SubsumeC e m)
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
Alternative m =>
SubsumeC e m a
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
Alternative m =>
SubsumeC e m a -> SubsumeC e m [a]
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
Alternative m =>
SubsumeC e m a -> SubsumeC e m a -> SubsumeC e m a
many :: SubsumeC e m a -> SubsumeC e m [a]
$cmany :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
Alternative m =>
SubsumeC e m a -> SubsumeC e m [a]
some :: SubsumeC e m a -> SubsumeC e m [a]
$csome :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
Alternative m =>
SubsumeC e m a -> SubsumeC e m [a]
<|> :: SubsumeC e m a -> SubsumeC e m a -> SubsumeC e m a
$c<|> :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
Alternative m =>
SubsumeC e m a -> SubsumeC e m a -> SubsumeC e m a
empty :: SubsumeC e m a
$cempty :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
Alternative m =>
SubsumeC e m a
$cp1Alternative :: forall (e :: (* -> *) -> * -> *) (m :: * -> *).
Alternative m =>
Applicative (SubsumeC e m)
Alternative, Monad (SubsumeC e m)
Alternative (SubsumeC e m)
SubsumeC e m a
Alternative (SubsumeC e m)
-> Monad (SubsumeC e m)
-> (forall a. SubsumeC e m a)
-> (forall a. SubsumeC e m a -> SubsumeC e m a -> SubsumeC e m a)
-> MonadPlus (SubsumeC e m)
SubsumeC e m a -> SubsumeC e m a -> SubsumeC e m a
forall a. SubsumeC e m a
forall a. SubsumeC e m a -> SubsumeC e m a -> SubsumeC e m a
forall (m :: * -> *).
Alternative m
-> Monad m
-> (forall a. m a)
-> (forall a. m a -> m a -> m a)
-> MonadPlus m
forall (e :: (* -> *) -> * -> *) (m :: * -> *).
MonadPlus m =>
Monad (SubsumeC e m)
forall (e :: (* -> *) -> * -> *) (m :: * -> *).
MonadPlus m =>
Alternative (SubsumeC e m)
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
MonadPlus m =>
SubsumeC e m a
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
MonadPlus m =>
SubsumeC e m a -> SubsumeC e m a -> SubsumeC e m a
mplus :: SubsumeC e m a -> SubsumeC e m a -> SubsumeC e m a
$cmplus :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
MonadPlus m =>
SubsumeC e m a -> SubsumeC e m a -> SubsumeC e m a
mzero :: SubsumeC e m a
$cmzero :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
MonadPlus m =>
SubsumeC e m a
$cp2MonadPlus :: forall (e :: (* -> *) -> * -> *) (m :: * -> *).
MonadPlus m =>
Monad (SubsumeC e m)
$cp1MonadPlus :: forall (e :: (* -> *) -> * -> *) (m :: * -> *).
MonadPlus m =>
Alternative (SubsumeC e m)
MonadPlus
, Monad (SubsumeC e m)
Monad (SubsumeC e m)
-> (forall a. (a -> SubsumeC e m a) -> SubsumeC e m a)
-> MonadFix (SubsumeC e m)
(a -> SubsumeC e m a) -> SubsumeC e m a
forall a. (a -> SubsumeC e m a) -> SubsumeC e m a
forall (m :: * -> *).
Monad m -> (forall a. (a -> m a) -> m a) -> MonadFix m
forall (e :: (* -> *) -> * -> *) (m :: * -> *).
MonadFix m =>
Monad (SubsumeC e m)
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
MonadFix m =>
(a -> SubsumeC e m a) -> SubsumeC e m a
mfix :: (a -> SubsumeC e m a) -> SubsumeC e m a
$cmfix :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
MonadFix m =>
(a -> SubsumeC e m a) -> SubsumeC e m a
$cp1MonadFix :: forall (e :: (* -> *) -> * -> *) (m :: * -> *).
MonadFix m =>
Monad (SubsumeC e m)
MonadFix, Monad (SubsumeC e m)
Monad (SubsumeC e m)
-> (forall a. String -> SubsumeC e m a) -> MonadFail (SubsumeC e m)
String -> SubsumeC e m a
forall a. String -> SubsumeC e m a
forall (m :: * -> *).
Monad m -> (forall a. String -> m a) -> MonadFail m
forall (e :: (* -> *) -> * -> *) (m :: * -> *).
MonadFail m =>
Monad (SubsumeC e m)
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
MonadFail m =>
String -> SubsumeC e m a
fail :: String -> SubsumeC e m a
$cfail :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
MonadFail m =>
String -> SubsumeC e m a
$cp1MonadFail :: forall (e :: (* -> *) -> * -> *) (m :: * -> *).
MonadFail m =>
Monad (SubsumeC e m)
MonadFail, Monad (SubsumeC e m)
Monad (SubsumeC e m)
-> (forall a. IO a -> SubsumeC e m a) -> MonadIO (SubsumeC e m)
IO a -> SubsumeC e m a
forall a. IO a -> SubsumeC e m a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
forall (e :: (* -> *) -> * -> *) (m :: * -> *).
MonadIO m =>
Monad (SubsumeC e m)
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
MonadIO m =>
IO a -> SubsumeC e m a
liftIO :: IO a -> SubsumeC e m a
$cliftIO :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
MonadIO m =>
IO a -> SubsumeC e m a
$cp1MonadIO :: forall (e :: (* -> *) -> * -> *) (m :: * -> *).
MonadIO m =>
Monad (SubsumeC e m)
MonadIO
, Monad (SubsumeC e m)
e -> SubsumeC e m a
Monad (SubsumeC e m)
-> (forall e a. Exception e => e -> SubsumeC e m a)
-> MonadThrow (SubsumeC e m)
forall e a. Exception e => e -> SubsumeC e m a
forall (m :: * -> *).
Monad m -> (forall e a. Exception e => e -> m a) -> MonadThrow m
forall (e :: (* -> *) -> * -> *) (m :: * -> *).
MonadThrow m =>
Monad (SubsumeC e m)
forall (e :: (* -> *) -> * -> *) (m :: * -> *) e a.
(MonadThrow m, Exception e) =>
e -> SubsumeC e m a
throwM :: e -> SubsumeC e m a
$cthrowM :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) e a.
(MonadThrow m, Exception e) =>
e -> SubsumeC e m a
$cp1MonadThrow :: forall (e :: (* -> *) -> * -> *) (m :: * -> *).
MonadThrow m =>
Monad (SubsumeC e m)
MonadThrow, MonadThrow (SubsumeC e m)
MonadThrow (SubsumeC e m)
-> (forall e a.
Exception e =>
SubsumeC e m a -> (e -> SubsumeC e m a) -> SubsumeC e m a)
-> MonadCatch (SubsumeC e m)
SubsumeC e m a -> (e -> SubsumeC e m a) -> SubsumeC e m a
forall e a.
Exception e =>
SubsumeC e m a -> (e -> SubsumeC e m a) -> SubsumeC e m a
forall (m :: * -> *).
MonadThrow m
-> (forall e a. Exception e => m a -> (e -> m a) -> m a)
-> MonadCatch m
forall (e :: (* -> *) -> * -> *) (m :: * -> *).
MonadCatch m =>
MonadThrow (SubsumeC e m)
forall (e :: (* -> *) -> * -> *) (m :: * -> *) e a.
(MonadCatch m, Exception e) =>
SubsumeC e m a -> (e -> SubsumeC e m a) -> SubsumeC e m a
catch :: SubsumeC e m a -> (e -> SubsumeC e m a) -> SubsumeC e m a
$ccatch :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) e a.
(MonadCatch m, Exception e) =>
SubsumeC e m a -> (e -> SubsumeC e m a) -> SubsumeC e m a
$cp1MonadCatch :: forall (e :: (* -> *) -> * -> *) (m :: * -> *).
MonadCatch m =>
MonadThrow (SubsumeC e m)
MonadCatch, MonadCatch (SubsumeC e m)
MonadCatch (SubsumeC e m)
-> (forall b.
((forall a. SubsumeC e m a -> SubsumeC e m a) -> SubsumeC e m b)
-> SubsumeC e m b)
-> (forall b.
((forall a. SubsumeC e m a -> SubsumeC e m a) -> SubsumeC e m b)
-> SubsumeC e m b)
-> (forall a b c.
SubsumeC e m a
-> (a -> ExitCase b -> SubsumeC e m c)
-> (a -> SubsumeC e m b)
-> SubsumeC e m (b, c))
-> MonadMask (SubsumeC e m)
SubsumeC e m a
-> (a -> ExitCase b -> SubsumeC e m c)
-> (a -> SubsumeC e m b)
-> SubsumeC e m (b, c)
((forall a. SubsumeC e m a -> SubsumeC e m a) -> SubsumeC e m b)
-> SubsumeC e m b
((forall a. SubsumeC e m a -> SubsumeC e m a) -> SubsumeC e m b)
-> SubsumeC e m b
forall b.
((forall a. SubsumeC e m a -> SubsumeC e m a) -> SubsumeC e m b)
-> SubsumeC e m b
forall a b c.
SubsumeC e m a
-> (a -> ExitCase b -> SubsumeC e m c)
-> (a -> SubsumeC e m b)
-> SubsumeC e m (b, c)
forall (m :: * -> *).
MonadCatch m
-> (forall b. ((forall a. m a -> m a) -> m b) -> m b)
-> (forall b. ((forall a. m a -> m a) -> m b) -> m b)
-> (forall a b c.
m a -> (a -> ExitCase b -> m c) -> (a -> m b) -> m (b, c))
-> MonadMask m
forall (e :: (* -> *) -> * -> *) (m :: * -> *).
MonadMask m =>
MonadCatch (SubsumeC e m)
forall (e :: (* -> *) -> * -> *) (m :: * -> *) b.
MonadMask m =>
((forall a. SubsumeC e m a -> SubsumeC e m a) -> SubsumeC e m b)
-> SubsumeC e m b
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a b c.
MonadMask m =>
SubsumeC e m a
-> (a -> ExitCase b -> SubsumeC e m c)
-> (a -> SubsumeC e m b)
-> SubsumeC e m (b, c)
generalBracket :: SubsumeC e m a
-> (a -> ExitCase b -> SubsumeC e m c)
-> (a -> SubsumeC e m b)
-> SubsumeC e m (b, c)
$cgeneralBracket :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a b c.
MonadMask m =>
SubsumeC e m a
-> (a -> ExitCase b -> SubsumeC e m c)
-> (a -> SubsumeC e m b)
-> SubsumeC e m (b, c)
uninterruptibleMask :: ((forall a. SubsumeC e m a -> SubsumeC e m a) -> SubsumeC e m b)
-> SubsumeC e m b
$cuninterruptibleMask :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) b.
MonadMask m =>
((forall a. SubsumeC e m a -> SubsumeC e m a) -> SubsumeC e m b)
-> SubsumeC e m b
mask :: ((forall a. SubsumeC e m a -> SubsumeC e m a) -> SubsumeC e m b)
-> SubsumeC e m b
$cmask :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) b.
MonadMask m =>
((forall a. SubsumeC e m a -> SubsumeC e m a) -> SubsumeC e m b)
-> SubsumeC e m b
$cp1MonadMask :: forall (e :: (* -> *) -> * -> *) (m :: * -> *).
MonadMask m =>
MonadCatch (SubsumeC e m)
MonadMask
, MonadBase b, MonadBaseControl b
)
via m
deriving (m a -> SubsumeC e m a
(forall (m :: * -> *) a. Monad m => m a -> SubsumeC e m a)
-> MonadTrans (SubsumeC e)
forall (m :: * -> *) a. Monad m => m a -> SubsumeC e m a
forall (t :: (* -> *) -> * -> *).
(forall (m :: * -> *) a. Monad m => m a -> t m a) -> MonadTrans t
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
Monad m =>
m a -> SubsumeC e m a
lift :: m a -> SubsumeC e m a
$clift :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
Monad m =>
m a -> SubsumeC e m a
MonadTrans, MonadTrans (SubsumeC e)
m (StT (SubsumeC e) a) -> SubsumeC e m a
MonadTrans (SubsumeC e)
-> (forall (m :: * -> *) a.
Monad m =>
(Run (SubsumeC e) -> m a) -> SubsumeC e m a)
-> (forall (m :: * -> *) a.
Monad m =>
m (StT (SubsumeC e) a) -> SubsumeC e m a)
-> MonadTransControl (SubsumeC e)
(Run (SubsumeC e) -> m a) -> SubsumeC e m a
forall (m :: * -> *) a.
Monad m =>
m (StT (SubsumeC e) a) -> SubsumeC e m a
forall (m :: * -> *) a.
Monad m =>
(Run (SubsumeC e) -> m a) -> SubsumeC e m a
forall (e :: (* -> *) -> * -> *). MonadTrans (SubsumeC e)
forall (t :: (* -> *) -> * -> *).
MonadTrans t
-> (forall (m :: * -> *) a. Monad m => (Run t -> m a) -> t m a)
-> (forall (m :: * -> *) a. Monad m => m (StT t a) -> t m a)
-> MonadTransControl t
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
Monad m =>
m (StT (SubsumeC e) a) -> SubsumeC e m a
forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
Monad m =>
(Run (SubsumeC e) -> m a) -> SubsumeC e m a
restoreT :: m (StT (SubsumeC e) a) -> SubsumeC e m a
$crestoreT :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
Monad m =>
m (StT (SubsumeC e) a) -> SubsumeC e m a
liftWith :: (Run (SubsumeC e) -> m a) -> SubsumeC e m a
$cliftWith :: forall (e :: (* -> *) -> * -> *) (m :: * -> *) a.
Monad m =>
(Run (SubsumeC e) -> m a) -> SubsumeC e m a
$cp1MonadTransControl :: forall (e :: (* -> *) -> * -> *). MonadTrans (SubsumeC e)
MonadTransControl) via IdentityT
instance ( Carrier m
, Member e (Derivs m)
)
=> Carrier (SubsumeC e m) where
type Derivs (SubsumeC e m) = e ': Derivs m
type Prims (SubsumeC e m) = Prims m
algPrims :: Algebra' (Prims (SubsumeC e m)) (SubsumeC e m) a
algPrims = (Union (Prims m) m a -> m a) -> Algebra' (Prims m) (SubsumeC e m) a
coerce (forall a. Carrier m => Algebra' (Prims m) m a
forall (m :: * -> *) x. Carrier m => Algebra' (Prims m) m x
algPrims @m)
{-# INLINE algPrims #-}
reformulate :: Reformulation'
(Derivs (SubsumeC e m)) (Prims (SubsumeC e m)) (SubsumeC e m) z a
reformulate forall x. SubsumeC e m x -> z x
n Algebra (Prims (SubsumeC e m)) z
alg = Algebra' (Derivs m) z a
-> (forall (z :: * -> *). Coercible z z => e z a -> z a)
-> Algebra' (e : Derivs m) z a
forall (e :: (* -> *) -> * -> *) (r :: [(* -> *) -> * -> *])
(m :: * -> *) a.
Algebra' r m a
-> (forall (z :: * -> *). Coercible z m => e z a -> m a)
-> Algebra' (e : r) m a
powerAlg' (Reformulation' (Derivs m) (Prims m) m z a
forall (m :: * -> *) (z :: * -> *) a.
(Carrier m, Monad z) =>
Reformulation' (Derivs m) (Prims m) m z a
reformulate (SubsumeC e m x -> z x
forall x. SubsumeC e m x -> z x
n (SubsumeC e m x -> z x) -> (m x -> SubsumeC e m x) -> m x -> z x
forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# m x -> SubsumeC e m x
forall k (e :: (* -> *) -> * -> *) (m :: k -> *) (a :: k).
m a -> SubsumeC e m a
SubsumeC) forall x. Union (Prims m) z x -> z x
Algebra (Prims (SubsumeC e m)) z
alg) ((forall (z :: * -> *). Coercible z z => e z a -> z a)
-> Algebra' (e : Derivs m) z a)
-> (forall (z :: * -> *). Coercible z z => e z a -> z a)
-> Algebra' (e : Derivs m) z a
forall a b. (a -> b) -> a -> b
$ \e z a
e ->
Reformulation' (Derivs m) (Prims m) m z a
forall (m :: * -> *) (z :: * -> *) a.
(Carrier m, Monad z) =>
Reformulation' (Derivs m) (Prims m) m z a
reformulate (SubsumeC e m x -> z x
forall x. SubsumeC e m x -> z x
n (SubsumeC e m x -> z x) -> (m x -> SubsumeC e m x) -> m x -> z x
forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# m x -> SubsumeC e m x
forall k (e :: (* -> *) -> * -> *) (m :: k -> *) (a :: k).
m a -> SubsumeC e m a
SubsumeC) forall x. Union (Prims m) z x -> z x
Algebra (Prims (SubsumeC e m)) z
alg (ElemOf e (Derivs m) -> e z a -> Union (Derivs m) z a
forall (z :: * -> *) (m :: * -> *) (e :: (* -> *) -> * -> *)
(r :: [(* -> *) -> * -> *]) a.
Coercible z m =>
ElemOf e r -> e z a -> Union r m a
Union ElemOf e (Derivs m)
forall k (e :: k) (r :: [k]). Member e r => ElemOf e r
membership e z a
e)
{-# INLINE reformulate #-}
algDerivs :: Algebra' (Derivs (SubsumeC e m)) (SubsumeC e m) a
algDerivs = Algebra' (Derivs m) (SubsumeC e m) a
-> (forall (z :: * -> *).
Coercible z (SubsumeC e m) =>
e z a -> SubsumeC e m a)
-> Algebra' (e : Derivs m) (SubsumeC e m) a
forall (e :: (* -> *) -> * -> *) (r :: [(* -> *) -> * -> *])
(m :: * -> *) a.
Algebra' r m a
-> (forall (z :: * -> *). Coercible z m => e z a -> m a)
-> Algebra' (e : r) m a
powerAlg' (Algebra' (Derivs m) m a -> Algebra' (Derivs m) (SubsumeC e m) a
coerce (forall a. Carrier m => Algebra' (Derivs m) m a
forall (m :: * -> *) a. Carrier m => Algebra' (Derivs m) m a
algDerivs @m)) ((forall (z :: * -> *).
Coercible z (SubsumeC e m) =>
e z a -> SubsumeC e m a)
-> Algebra' (e : Derivs m) (SubsumeC e m) a)
-> (forall (z :: * -> *).
Coercible z (SubsumeC e m) =>
e z a -> SubsumeC e m a)
-> Algebra' (e : Derivs m) (SubsumeC e m) a
forall a b. (a -> b) -> a -> b
$ \e z a
e ->
Algebra' (Derivs m) m a -> Algebra' (Derivs m) (SubsumeC e m) a
forall (n :: * -> *) (m :: * -> *) (e :: (* -> *) -> * -> *) a b.
(Coercible n m, RepresentationalEff e) =>
(e m a -> m b) -> e n a -> n b
coerceAlg (forall a. Carrier m => Algebra' (Derivs m) m a
forall (m :: * -> *) a. Carrier m => Algebra' (Derivs m) m a
algDerivs @m) (ElemOf e (Derivs m) -> e z a -> Union (Derivs m) (SubsumeC e m) a
forall (z :: * -> *) (m :: * -> *) (e :: (* -> *) -> * -> *)
(r :: [(* -> *) -> * -> *]) a.
Coercible z m =>
ElemOf e r -> e z a -> Union r m a
Union ElemOf e (Derivs m)
forall k (e :: k) (r :: [k]). Member e r => ElemOf e r
membership e z a
e)
{-# INLINE algDerivs #-}
subsume :: ( Carrier m
, Member e (Derivs m)
)
=> SubsumeC e m a
-> m a
subsume :: SubsumeC e m a -> m a
subsume = SubsumeC e m a -> m a
forall (e :: (* -> *) -> * -> *) k (m :: k -> *) (a :: k).
SubsumeC e m a -> m a
unSubsumeC
{-# INLINE subsume #-}