module Control.Effect.Internal.Itself where

import Control.Monad.Base
import Control.Monad.Trans.Control

newtype Itself m a = Itself { Itself m a -> m a
unItself :: m a }
  deriving (a -> Itself m b -> Itself m a
(a -> b) -> Itself m a -> Itself m b
(forall a b. (a -> b) -> Itself m a -> Itself m b)
-> (forall a b. a -> Itself m b -> Itself m a)
-> Functor (Itself m)
forall a b. a -> Itself m b -> Itself m a
forall a b. (a -> b) -> Itself m a -> Itself m b
forall (m :: * -> *) a b.
Functor m =>
a -> Itself m b -> Itself m a
forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> Itself m a -> Itself m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Itself m b -> Itself m a
$c<$ :: forall (m :: * -> *) a b.
Functor m =>
a -> Itself m b -> Itself m a
fmap :: (a -> b) -> Itself m a -> Itself m b
$cfmap :: forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> Itself m a -> Itself m b
Functor, Functor (Itself m)
a -> Itself m a
Functor (Itself m)
-> (forall a. a -> Itself m a)
-> (forall a b. Itself m (a -> b) -> Itself m a -> Itself m b)
-> (forall a b c.
    (a -> b -> c) -> Itself m a -> Itself m b -> Itself m c)
-> (forall a b. Itself m a -> Itself m b -> Itself m b)
-> (forall a b. Itself m a -> Itself m b -> Itself m a)
-> Applicative (Itself m)
Itself m a -> Itself m b -> Itself m b
Itself m a -> Itself m b -> Itself m a
Itself m (a -> b) -> Itself m a -> Itself m b
(a -> b -> c) -> Itself m a -> Itself m b -> Itself m c
forall a. a -> Itself m a
forall a b. Itself m a -> Itself m b -> Itself m a
forall a b. Itself m a -> Itself m b -> Itself m b
forall a b. Itself m (a -> b) -> Itself m a -> Itself m b
forall a b c.
(a -> b -> c) -> Itself m a -> Itself m b -> Itself 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 (Itself m)
forall (m :: * -> *) a. Applicative m => a -> Itself m a
forall (m :: * -> *) a b.
Applicative m =>
Itself m a -> Itself m b -> Itself m a
forall (m :: * -> *) a b.
Applicative m =>
Itself m a -> Itself m b -> Itself m b
forall (m :: * -> *) a b.
Applicative m =>
Itself m (a -> b) -> Itself m a -> Itself m b
forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c) -> Itself m a -> Itself m b -> Itself m c
<* :: Itself m a -> Itself m b -> Itself m a
$c<* :: forall (m :: * -> *) a b.
Applicative m =>
Itself m a -> Itself m b -> Itself m a
*> :: Itself m a -> Itself m b -> Itself m b
$c*> :: forall (m :: * -> *) a b.
Applicative m =>
Itself m a -> Itself m b -> Itself m b
liftA2 :: (a -> b -> c) -> Itself m a -> Itself m b -> Itself m c
$cliftA2 :: forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c) -> Itself m a -> Itself m b -> Itself m c
<*> :: Itself m (a -> b) -> Itself m a -> Itself m b
$c<*> :: forall (m :: * -> *) a b.
Applicative m =>
Itself m (a -> b) -> Itself m a -> Itself m b
pure :: a -> Itself m a
$cpure :: forall (m :: * -> *) a. Applicative m => a -> Itself m a
$cp1Applicative :: forall (m :: * -> *). Applicative m => Functor (Itself m)
Applicative, Applicative (Itself m)
a -> Itself m a
Applicative (Itself m)
-> (forall a b. Itself m a -> (a -> Itself m b) -> Itself m b)
-> (forall a b. Itself m a -> Itself m b -> Itself m b)
-> (forall a. a -> Itself m a)
-> Monad (Itself m)
Itself m a -> (a -> Itself m b) -> Itself m b
Itself m a -> Itself m b -> Itself m b
forall a. a -> Itself m a
forall a b. Itself m a -> Itself m b -> Itself m b
forall a b. Itself m a -> (a -> Itself m b) -> Itself m b
forall (m :: * -> *). Monad m => Applicative (Itself m)
forall (m :: * -> *) a. Monad m => a -> Itself m a
forall (m :: * -> *) a b.
Monad m =>
Itself m a -> Itself m b -> Itself m b
forall (m :: * -> *) a b.
Monad m =>
Itself m a -> (a -> Itself m b) -> Itself 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 -> Itself m a
$creturn :: forall (m :: * -> *) a. Monad m => a -> Itself m a
>> :: Itself m a -> Itself m b -> Itself m b
$c>> :: forall (m :: * -> *) a b.
Monad m =>
Itself m a -> Itself m b -> Itself m b
>>= :: Itself m a -> (a -> Itself m b) -> Itself m b
$c>>= :: forall (m :: * -> *) a b.
Monad m =>
Itself m a -> (a -> Itself m b) -> Itself m b
$cp1Monad :: forall (m :: * -> *). Monad m => Applicative (Itself m)
Monad)

instance Monad m => MonadBase m (Itself m) where
  liftBase :: m α -> Itself m α
liftBase = m α -> Itself m α
forall k (m :: k -> *) (a :: k). m a -> Itself m a
Itself
  {-# INLINE liftBase #-}

instance Monad m => MonadBaseControl m (Itself m) where
  type StM (Itself m) a = a

  liftBaseWith :: (RunInBase (Itself m) m -> m a) -> Itself m a
liftBaseWith RunInBase (Itself m) m -> m a
m = m a -> Itself m a
forall k (m :: k -> *) (a :: k). m a -> Itself m a
Itself (RunInBase (Itself m) m -> m a
m RunInBase (Itself m) m
forall k (m :: k -> *) (a :: k). Itself m a -> m a
unItself)
  {-# INLINE liftBaseWith #-}

  restoreM :: StM (Itself m) a -> Itself m a
restoreM = StM (Itself m) a -> Itself m a
forall (m :: * -> *) a. Monad m => a -> m a
return
  {-# INLINE restoreM #-}