{-# LANGUAGE DerivingVia, MagicHash #-}
{-# OPTIONS_HADDOCK not-home #-}
module Control.Effect.Internal.BaseControl where

import Control.Effect.Carrier
import Control.Effect.Internal.Itself
import Control.Effect.Carrier.Internal.Interpret

import Control.Effect.Type.Internal.BaseControl

import GHC.Exts (Proxy#, proxy#)

data BaseControlH

instance Carrier m => PrimHandler BaseControlH (BaseControl m) m where
  effPrimHandler :: BaseControl m m x -> m x
effPrimHandler (GainBaseControl forall (z :: * -> *).
(MonadBaseControl m z, Coercible z m) =>
Proxy# z -> x
main) = x -> m x
forall (m :: * -> *) a. Monad m => a -> m a
return (x -> m x) -> x -> m x
forall a b. (a -> b) -> a -> b
$ Proxy# (Itself m) -> x
forall (z :: * -> *).
(MonadBaseControl m z, Coercible z m) =>
Proxy# z -> x
main (Proxy# (Itself m)
forall k (a :: k). Proxy# a
proxy# :: Proxy# (Itself m))
  {-# INLINE effPrimHandler #-}

newtype BaseControlC m a = BaseControlC {
    BaseControlC m a -> m a
unBaseControlC :: m a
  }
  deriving ( a -> BaseControlC m b -> BaseControlC m a
(a -> b) -> BaseControlC m a -> BaseControlC m b
(forall a b. (a -> b) -> BaseControlC m a -> BaseControlC m b)
-> (forall a b. a -> BaseControlC m b -> BaseControlC m a)
-> Functor (BaseControlC m)
forall a b. a -> BaseControlC m b -> BaseControlC m a
forall a b. (a -> b) -> BaseControlC m a -> BaseControlC m b
forall (m :: * -> *) a b.
Functor m =>
a -> BaseControlC m b -> BaseControlC m a
forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> BaseControlC m a -> BaseControlC m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> BaseControlC m b -> BaseControlC m a
$c<$ :: forall (m :: * -> *) a b.
Functor m =>
a -> BaseControlC m b -> BaseControlC m a
fmap :: (a -> b) -> BaseControlC m a -> BaseControlC m b
$cfmap :: forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> BaseControlC m a -> BaseControlC m b
Functor, Functor (BaseControlC m)
a -> BaseControlC m a
Functor (BaseControlC m)
-> (forall a. a -> BaseControlC m a)
-> (forall a b.
    BaseControlC m (a -> b) -> BaseControlC m a -> BaseControlC m b)
-> (forall a b c.
    (a -> b -> c)
    -> BaseControlC m a -> BaseControlC m b -> BaseControlC m c)
-> (forall a b.
    BaseControlC m a -> BaseControlC m b -> BaseControlC m b)
-> (forall a b.
    BaseControlC m a -> BaseControlC m b -> BaseControlC m a)
-> Applicative (BaseControlC m)
BaseControlC m a -> BaseControlC m b -> BaseControlC m b
BaseControlC m a -> BaseControlC m b -> BaseControlC m a
BaseControlC m (a -> b) -> BaseControlC m a -> BaseControlC m b
(a -> b -> c)
-> BaseControlC m a -> BaseControlC m b -> BaseControlC m c
forall a. a -> BaseControlC m a
forall a b.
BaseControlC m a -> BaseControlC m b -> BaseControlC m a
forall a b.
BaseControlC m a -> BaseControlC m b -> BaseControlC m b
forall a b.
BaseControlC m (a -> b) -> BaseControlC m a -> BaseControlC m b
forall a b c.
(a -> b -> c)
-> BaseControlC m a -> BaseControlC m b -> BaseControlC 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 (m :: * -> *). Applicative m => Functor (BaseControlC m)
forall (m :: * -> *) a. Applicative m => a -> BaseControlC m a
forall (m :: * -> *) a b.
Applicative m =>
BaseControlC m a -> BaseControlC m b -> BaseControlC m a
forall (m :: * -> *) a b.
Applicative m =>
BaseControlC m a -> BaseControlC m b -> BaseControlC m b
forall (m :: * -> *) a b.
Applicative m =>
BaseControlC m (a -> b) -> BaseControlC m a -> BaseControlC m b
forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> BaseControlC m a -> BaseControlC m b -> BaseControlC m c
<* :: BaseControlC m a -> BaseControlC m b -> BaseControlC m a
$c<* :: forall (m :: * -> *) a b.
Applicative m =>
BaseControlC m a -> BaseControlC m b -> BaseControlC m a
*> :: BaseControlC m a -> BaseControlC m b -> BaseControlC m b
$c*> :: forall (m :: * -> *) a b.
Applicative m =>
BaseControlC m a -> BaseControlC m b -> BaseControlC m b
liftA2 :: (a -> b -> c)
-> BaseControlC m a -> BaseControlC m b -> BaseControlC m c
$cliftA2 :: forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> BaseControlC m a -> BaseControlC m b -> BaseControlC m c
<*> :: BaseControlC m (a -> b) -> BaseControlC m a -> BaseControlC m b
$c<*> :: forall (m :: * -> *) a b.
Applicative m =>
BaseControlC m (a -> b) -> BaseControlC m a -> BaseControlC m b
pure :: a -> BaseControlC m a
$cpure :: forall (m :: * -> *) a. Applicative m => a -> BaseControlC m a
$cp1Applicative :: forall (m :: * -> *). Applicative m => Functor (BaseControlC m)
Applicative, Applicative (BaseControlC m)
a -> BaseControlC m a
Applicative (BaseControlC m)
-> (forall a b.
    BaseControlC m a -> (a -> BaseControlC m b) -> BaseControlC m b)
-> (forall a b.
    BaseControlC m a -> BaseControlC m b -> BaseControlC m b)
-> (forall a. a -> BaseControlC m a)
-> Monad (BaseControlC m)
BaseControlC m a -> (a -> BaseControlC m b) -> BaseControlC m b
BaseControlC m a -> BaseControlC m b -> BaseControlC m b
forall a. a -> BaseControlC m a
forall a b.
BaseControlC m a -> BaseControlC m b -> BaseControlC m b
forall a b.
BaseControlC m a -> (a -> BaseControlC m b) -> BaseControlC m b
forall (m :: * -> *). Monad m => Applicative (BaseControlC m)
forall (m :: * -> *) a. Monad m => a -> BaseControlC m a
forall (m :: * -> *) a b.
Monad m =>
BaseControlC m a -> BaseControlC m b -> BaseControlC m b
forall (m :: * -> *) a b.
Monad m =>
BaseControlC m a -> (a -> BaseControlC m b) -> BaseControlC 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
return :: a -> BaseControlC m a
$creturn :: forall (m :: * -> *) a. Monad m => a -> BaseControlC m a
>> :: BaseControlC m a -> BaseControlC m b -> BaseControlC m b
$c>> :: forall (m :: * -> *) a b.
Monad m =>
BaseControlC m a -> BaseControlC m b -> BaseControlC m b
>>= :: BaseControlC m a -> (a -> BaseControlC m b) -> BaseControlC m b
$c>>= :: forall (m :: * -> *) a b.
Monad m =>
BaseControlC m a -> (a -> BaseControlC m b) -> BaseControlC m b
$cp1Monad :: forall (m :: * -> *). Monad m => Applicative (BaseControlC m)
Monad
           , Applicative (BaseControlC m)
BaseControlC m a
Applicative (BaseControlC m)
-> (forall a. BaseControlC m a)
-> (forall a.
    BaseControlC m a -> BaseControlC m a -> BaseControlC m a)
-> (forall a. BaseControlC m a -> BaseControlC m [a])
-> (forall a. BaseControlC m a -> BaseControlC m [a])
-> Alternative (BaseControlC m)
BaseControlC m a -> BaseControlC m a -> BaseControlC m a
BaseControlC m a -> BaseControlC m [a]
BaseControlC m a -> BaseControlC m [a]
forall a. BaseControlC m a
forall a. BaseControlC m a -> BaseControlC m [a]
forall a. BaseControlC m a -> BaseControlC m a -> BaseControlC 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 (m :: * -> *). Alternative m => Applicative (BaseControlC m)
forall (m :: * -> *) a. Alternative m => BaseControlC m a
forall (m :: * -> *) a.
Alternative m =>
BaseControlC m a -> BaseControlC m [a]
forall (m :: * -> *) a.
Alternative m =>
BaseControlC m a -> BaseControlC m a -> BaseControlC m a
many :: BaseControlC m a -> BaseControlC m [a]
$cmany :: forall (m :: * -> *) a.
Alternative m =>
BaseControlC m a -> BaseControlC m [a]
some :: BaseControlC m a -> BaseControlC m [a]
$csome :: forall (m :: * -> *) a.
Alternative m =>
BaseControlC m a -> BaseControlC m [a]
<|> :: BaseControlC m a -> BaseControlC m a -> BaseControlC m a
$c<|> :: forall (m :: * -> *) a.
Alternative m =>
BaseControlC m a -> BaseControlC m a -> BaseControlC m a
empty :: BaseControlC m a
$cempty :: forall (m :: * -> *) a. Alternative m => BaseControlC m a
$cp1Alternative :: forall (m :: * -> *). Alternative m => Applicative (BaseControlC m)
Alternative, Monad (BaseControlC m)
Alternative (BaseControlC m)
BaseControlC m a
Alternative (BaseControlC m)
-> Monad (BaseControlC m)
-> (forall a. BaseControlC m a)
-> (forall a.
    BaseControlC m a -> BaseControlC m a -> BaseControlC m a)
-> MonadPlus (BaseControlC m)
BaseControlC m a -> BaseControlC m a -> BaseControlC m a
forall a. BaseControlC m a
forall a. BaseControlC m a -> BaseControlC m a -> BaseControlC m a
forall (m :: * -> *).
Alternative m
-> Monad m
-> (forall a. m a)
-> (forall a. m a -> m a -> m a)
-> MonadPlus m
forall (m :: * -> *). MonadPlus m => Monad (BaseControlC m)
forall (m :: * -> *). MonadPlus m => Alternative (BaseControlC m)
forall (m :: * -> *) a. MonadPlus m => BaseControlC m a
forall (m :: * -> *) a.
MonadPlus m =>
BaseControlC m a -> BaseControlC m a -> BaseControlC m a
mplus :: BaseControlC m a -> BaseControlC m a -> BaseControlC m a
$cmplus :: forall (m :: * -> *) a.
MonadPlus m =>
BaseControlC m a -> BaseControlC m a -> BaseControlC m a
mzero :: BaseControlC m a
$cmzero :: forall (m :: * -> *) a. MonadPlus m => BaseControlC m a
$cp2MonadPlus :: forall (m :: * -> *). MonadPlus m => Monad (BaseControlC m)
$cp1MonadPlus :: forall (m :: * -> *). MonadPlus m => Alternative (BaseControlC m)
MonadPlus
           , Monad (BaseControlC m)
Monad (BaseControlC m)
-> (forall a. (a -> BaseControlC m a) -> BaseControlC m a)
-> MonadFix (BaseControlC m)
(a -> BaseControlC m a) -> BaseControlC m a
forall a. (a -> BaseControlC m a) -> BaseControlC m a
forall (m :: * -> *).
Monad m -> (forall a. (a -> m a) -> m a) -> MonadFix m
forall (m :: * -> *). MonadFix m => Monad (BaseControlC m)
forall (m :: * -> *) a.
MonadFix m =>
(a -> BaseControlC m a) -> BaseControlC m a
mfix :: (a -> BaseControlC m a) -> BaseControlC m a
$cmfix :: forall (m :: * -> *) a.
MonadFix m =>
(a -> BaseControlC m a) -> BaseControlC m a
$cp1MonadFix :: forall (m :: * -> *). MonadFix m => Monad (BaseControlC m)
MonadFix, Monad (BaseControlC m)
Monad (BaseControlC m)
-> (forall a. String -> BaseControlC m a)
-> MonadFail (BaseControlC m)
String -> BaseControlC m a
forall a. String -> BaseControlC m a
forall (m :: * -> *).
Monad m -> (forall a. String -> m a) -> MonadFail m
forall (m :: * -> *). MonadFail m => Monad (BaseControlC m)
forall (m :: * -> *) a. MonadFail m => String -> BaseControlC m a
fail :: String -> BaseControlC m a
$cfail :: forall (m :: * -> *) a. MonadFail m => String -> BaseControlC m a
$cp1MonadFail :: forall (m :: * -> *). MonadFail m => Monad (BaseControlC m)
MonadFail, Monad (BaseControlC m)
Monad (BaseControlC m)
-> (forall a. IO a -> BaseControlC m a) -> MonadIO (BaseControlC m)
IO a -> BaseControlC m a
forall a. IO a -> BaseControlC m a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
forall (m :: * -> *). MonadIO m => Monad (BaseControlC m)
forall (m :: * -> *) a. MonadIO m => IO a -> BaseControlC m a
liftIO :: IO a -> BaseControlC m a
$cliftIO :: forall (m :: * -> *) a. MonadIO m => IO a -> BaseControlC m a
$cp1MonadIO :: forall (m :: * -> *). MonadIO m => Monad (BaseControlC m)
MonadIO
           , Monad (BaseControlC m)
e -> BaseControlC m a
Monad (BaseControlC m)
-> (forall e a. Exception e => e -> BaseControlC m a)
-> MonadThrow (BaseControlC m)
forall e a. Exception e => e -> BaseControlC m a
forall (m :: * -> *).
Monad m -> (forall e a. Exception e => e -> m a) -> MonadThrow m
forall (m :: * -> *). MonadThrow m => Monad (BaseControlC m)
forall (m :: * -> *) e a.
(MonadThrow m, Exception e) =>
e -> BaseControlC m a
throwM :: e -> BaseControlC m a
$cthrowM :: forall (m :: * -> *) e a.
(MonadThrow m, Exception e) =>
e -> BaseControlC m a
$cp1MonadThrow :: forall (m :: * -> *). MonadThrow m => Monad (BaseControlC m)
MonadThrow, MonadThrow (BaseControlC m)
MonadThrow (BaseControlC m)
-> (forall e a.
    Exception e =>
    BaseControlC m a -> (e -> BaseControlC m a) -> BaseControlC m a)
-> MonadCatch (BaseControlC m)
BaseControlC m a -> (e -> BaseControlC m a) -> BaseControlC m a
forall e a.
Exception e =>
BaseControlC m a -> (e -> BaseControlC m a) -> BaseControlC m a
forall (m :: * -> *).
MonadThrow m
-> (forall e a. Exception e => m a -> (e -> m a) -> m a)
-> MonadCatch m
forall (m :: * -> *). MonadCatch m => MonadThrow (BaseControlC m)
forall (m :: * -> *) e a.
(MonadCatch m, Exception e) =>
BaseControlC m a -> (e -> BaseControlC m a) -> BaseControlC m a
catch :: BaseControlC m a -> (e -> BaseControlC m a) -> BaseControlC m a
$ccatch :: forall (m :: * -> *) e a.
(MonadCatch m, Exception e) =>
BaseControlC m a -> (e -> BaseControlC m a) -> BaseControlC m a
$cp1MonadCatch :: forall (m :: * -> *). MonadCatch m => MonadThrow (BaseControlC m)
MonadCatch, MonadCatch (BaseControlC m)
MonadCatch (BaseControlC m)
-> (forall b.
    ((forall a. BaseControlC m a -> BaseControlC m a)
     -> BaseControlC m b)
    -> BaseControlC m b)
-> (forall b.
    ((forall a. BaseControlC m a -> BaseControlC m a)
     -> BaseControlC m b)
    -> BaseControlC m b)
-> (forall a b c.
    BaseControlC m a
    -> (a -> ExitCase b -> BaseControlC m c)
    -> (a -> BaseControlC m b)
    -> BaseControlC m (b, c))
-> MonadMask (BaseControlC m)
BaseControlC m a
-> (a -> ExitCase b -> BaseControlC m c)
-> (a -> BaseControlC m b)
-> BaseControlC m (b, c)
((forall a. BaseControlC m a -> BaseControlC m a)
 -> BaseControlC m b)
-> BaseControlC m b
((forall a. BaseControlC m a -> BaseControlC m a)
 -> BaseControlC m b)
-> BaseControlC m b
forall b.
((forall a. BaseControlC m a -> BaseControlC m a)
 -> BaseControlC m b)
-> BaseControlC m b
forall a b c.
BaseControlC m a
-> (a -> ExitCase b -> BaseControlC m c)
-> (a -> BaseControlC m b)
-> BaseControlC 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 (m :: * -> *). MonadMask m => MonadCatch (BaseControlC m)
forall (m :: * -> *) b.
MonadMask m =>
((forall a. BaseControlC m a -> BaseControlC m a)
 -> BaseControlC m b)
-> BaseControlC m b
forall (m :: * -> *) a b c.
MonadMask m =>
BaseControlC m a
-> (a -> ExitCase b -> BaseControlC m c)
-> (a -> BaseControlC m b)
-> BaseControlC m (b, c)
generalBracket :: BaseControlC m a
-> (a -> ExitCase b -> BaseControlC m c)
-> (a -> BaseControlC m b)
-> BaseControlC m (b, c)
$cgeneralBracket :: forall (m :: * -> *) a b c.
MonadMask m =>
BaseControlC m a
-> (a -> ExitCase b -> BaseControlC m c)
-> (a -> BaseControlC m b)
-> BaseControlC m (b, c)
uninterruptibleMask :: ((forall a. BaseControlC m a -> BaseControlC m a)
 -> BaseControlC m b)
-> BaseControlC m b
$cuninterruptibleMask :: forall (m :: * -> *) b.
MonadMask m =>
((forall a. BaseControlC m a -> BaseControlC m a)
 -> BaseControlC m b)
-> BaseControlC m b
mask :: ((forall a. BaseControlC m a -> BaseControlC m a)
 -> BaseControlC m b)
-> BaseControlC m b
$cmask :: forall (m :: * -> *) b.
MonadMask m =>
((forall a. BaseControlC m a -> BaseControlC m a)
 -> BaseControlC m b)
-> BaseControlC m b
$cp1MonadMask :: forall (m :: * -> *). MonadMask m => MonadCatch (BaseControlC m)
MonadMask
           )
  deriving (m a -> BaseControlC m a
(forall (m :: * -> *) a. Monad m => m a -> BaseControlC m a)
-> MonadTrans BaseControlC
forall (m :: * -> *) a. Monad m => m a -> BaseControlC m a
forall (t :: Effect).
(forall (m :: * -> *) a. Monad m => m a -> t m a) -> MonadTrans t
lift :: m a -> BaseControlC m a
$clift :: forall (m :: * -> *) a. Monad m => m a -> BaseControlC m a
MonadTrans, MonadTrans BaseControlC
m (StT BaseControlC a) -> BaseControlC m a
MonadTrans BaseControlC
-> (forall (m :: * -> *) a.
    Monad m =>
    (Run BaseControlC -> m a) -> BaseControlC m a)
-> (forall (m :: * -> *) a.
    Monad m =>
    m (StT BaseControlC a) -> BaseControlC m a)
-> MonadTransControl BaseControlC
(Run BaseControlC -> m a) -> BaseControlC m a
forall (m :: * -> *) a.
Monad m =>
m (StT BaseControlC a) -> BaseControlC m a
forall (m :: * -> *) a.
Monad m =>
(Run BaseControlC -> m a) -> BaseControlC m a
forall (t :: Effect).
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
restoreT :: m (StT BaseControlC a) -> BaseControlC m a
$crestoreT :: forall (m :: * -> *) a.
Monad m =>
m (StT BaseControlC a) -> BaseControlC m a
liftWith :: (Run BaseControlC -> m a) -> BaseControlC m a
$cliftWith :: forall (m :: * -> *) a.
Monad m =>
(Run BaseControlC -> m a) -> BaseControlC m a
$cp1MonadTransControl :: MonadTrans BaseControlC
MonadTransControl) via IdentityT

deriving via InterpretPrimC BaseControlH (BaseControl m) m
    instance Carrier m => Carrier (BaseControlC m)