{-# LANGUAGE DefaultSignatures, DerivingVia #-}
{-# OPTIONS_HADDOCK not-home #-}
module Control.Effect.Internal.Newtype
  (
    WrapC(WrapC)
  , wrap
  , wrapWith

  , UnwrapC(UnwrapC)
  , unwrap

  , UnwrapTopC(UnwrapTopC)
  , unwrapTop

  , EffNewtype(..)

  , WrapperOf(..)
  ) where

import Data.Coerce

import Control.Monad.Trans.Identity
import Control.Effect
import Control.Effect.Carrier
import Control.Effect.Internal.Utils

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

instance ( Member e' (Derivs m)
         , Coercible e e'
         , Carrier m
         )
      => Carrier (WrapC e e' m) where
  type Derivs (WrapC e e' m) = e ': Derivs m
  type Prims  (WrapC e e' m) = Prims m

  algPrims :: Algebra' (Prims (WrapC e e' m)) (WrapC e e' m) a
algPrims = (Union (Prims m) m a -> m a) -> Algebra' (Prims m) (WrapC e e' m) a
coerce (forall a. Carrier m => Algebra' (Prims m) m a
forall (m :: * -> *) a. Carrier m => Algebra' (Prims m) m a
algPrims @m)
  {-# INLINEABLE algPrims #-}

  reformulate :: Reformulation'
  (Derivs (WrapC e e' m)) (Prims (WrapC e e' m)) (WrapC e e' m) z a
reformulate forall x. WrapC e e' m x -> z x
n Algebra (Prims (WrapC e 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 :: Effect) (r :: [Effect]) (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 (WrapC e e' m x -> z x
forall x. WrapC e e' m x -> z x
n (WrapC e e' m x -> z x) -> (m x -> WrapC e e' m x) -> m x -> z x
forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# m x -> WrapC e e' m x
forall (e :: Effect) (e' :: Effect) (m :: * -> *) a.
m a -> WrapC e e' m a
WrapC) forall x. Union (Prims m) z x -> z x
Algebra (Prims (WrapC e 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 :: e z x) -> Reformulation'
  (Derivs (WrapC e e' m)) (Prims (WrapC e e' m)) (WrapC e e' m) z a
forall (m :: * -> *) (z :: * -> *) a.
(Carrier m, Monad z) =>
Reformulation' (Derivs m) (Prims m) m z a
reformulate forall x. WrapC e e' m x -> z x
n Algebra (Prims (WrapC e e' m)) z
alg (ElemOf e' (Derivs (WrapC e e' m))
-> e' z a -> Union (Derivs (WrapC e e' m)) z a
forall (z :: * -> *) (m :: * -> *) (e :: Effect) (r :: [Effect]) a.
Coercible z m =>
ElemOf e r -> e z a -> Union r m a
Union ElemOf e' (Derivs (WrapC e e' m))
forall k (e :: k) (r :: [k]). Member e r => ElemOf e r
membership (e z a -> e' z a
coerce e z a
e :: e' z x))
  {-# INLINEABLE reformulate #-}

  algDerivs :: Algebra' (Derivs (WrapC e e' m)) (WrapC e e' m) a
algDerivs = Algebra' (Derivs m) (WrapC e e' m) a
-> (forall (z :: * -> *).
    Coercible z (WrapC e e' m) =>
    e z a -> WrapC e e' m a)
-> Algebra' (e : Derivs m) (WrapC e e' m) a
forall (e :: Effect) (r :: [Effect]) (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) (WrapC e 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 (WrapC e e' m) =>
  e z a -> WrapC e e' m a)
 -> Algebra' (e : Derivs m) (WrapC e e' m) a)
-> (forall (z :: * -> *).
    Coercible z (WrapC e e' m) =>
    e z a -> WrapC e e' m a)
-> Algebra' (e : Derivs m) (WrapC e e' m) a
forall a b. (a -> b) -> a -> b
$
    \(e :: e z x) -> Algebra' (Derivs (WrapC e e' m)) (WrapC e e' m) a
forall (m :: * -> *) a. Carrier m => Algebra' (Derivs m) m a
algDerivs (ElemOf e' (e : Derivs m)
-> e' z a -> Union (e : Derivs m) (WrapC e e' m) a
forall (z :: * -> *) (m :: * -> *) (e :: Effect) (r :: [Effect]) a.
Coercible z m =>
ElemOf e r -> e z a -> Union r m a
Union ElemOf e' (e : Derivs m)
forall k (e :: k) (r :: [k]). Member e r => ElemOf e r
membership (e z a -> e' z a
coerce e z a
e :: e' z x))
  {-# INLINEABLE algDerivs #-}

wrap :: ( Member e (Derivs m)
        , Carrier m
        , Coercible unwrappedE e
        )
     => WrapC unwrappedE e m a
     -> m a
wrap :: WrapC unwrappedE e m a -> m a
wrap = WrapC unwrappedE e m a -> m a
forall (e :: Effect) (e' :: Effect) (m :: * -> *) a.
WrapC e e' m a -> m a
unWrapC
{-# INLINE wrap #-}

-- | Wrap uses of an effect, injecting them into a newtype of that effect.
-- The first argument is ignored.
--
-- This is useful for creating actions of effect newtypes.
-- For example:
--
-- @
-- newtype Counter m a = Counter ('Control.Effect.State.State' Int m)
--
-- probe :: Eff Counter m => m Int
-- probe = 'wrapWith' Counter $ 'Control.Effect.State.state'' \@Int (\\s -> (s + 1, s))
-- @
--
wrapWith :: ( Member e (Derivs m)
            , Carrier m
            , Coercible unwrappedE e
            )
         => (unwrappedE z x -> e z x)
         -> WrapC unwrappedE e m a
         -> m a
wrapWith :: (unwrappedE z x -> e z x) -> WrapC unwrappedE e m a -> m a
wrapWith unwrappedE z x -> e z x
_ = WrapC unwrappedE e m a -> m a
forall (e :: Effect) (m :: * -> *) (unwrappedE :: Effect) a.
(Member e (Derivs m), Carrier m, Coercible unwrappedE e) =>
WrapC unwrappedE e m a -> m a
wrap
{-# INLINE wrapWith #-}

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

instance ( Carrier m
         , Member (UnwrappedEff e) (Derivs m)
         , EffNewtype e
         )
      => Carrier (UnwrapC e m) where
  type Derivs (UnwrapC e m) = e ': Derivs m
  type Prims  (UnwrapC e m) = Prims m

  algPrims :: Algebra' (Prims (UnwrapC e m)) (UnwrapC e m) a
algPrims = (Union (Prims m) m a -> m a) -> Algebra' (Prims m) (UnwrapC e m) a
coerce (forall a. Carrier m => Algebra' (Prims m) m a
forall (m :: * -> *) a. Carrier m => Algebra' (Prims m) m a
algPrims @m)
  {-# INLINEABLE algPrims #-}

  reformulate :: Reformulation'
  (Derivs (UnwrapC e m)) (Prims (UnwrapC e m)) (UnwrapC e m) z a
reformulate forall x. UnwrapC e m x -> z x
n Algebra (Prims (UnwrapC 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 :: Effect) (r :: [Effect]) (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 (UnwrapC e m x -> z x
forall x. UnwrapC e m x -> z x
n (UnwrapC e m x -> z x) -> (m x -> UnwrapC e m x) -> m x -> z x
forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# m x -> UnwrapC e m x
forall (e :: Effect) (m :: * -> *) a. m a -> UnwrapC e m a
UnwrapC) forall x. Union (Prims m) z x -> z x
Algebra (Prims (UnwrapC 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 (UnwrapC e m x -> z x
forall x. UnwrapC e m x -> z x
n (UnwrapC e m x -> z x) -> (m x -> UnwrapC e m x) -> m x -> z x
forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# m x -> UnwrapC e m x
forall (e :: Effect) (m :: * -> *) a. m a -> UnwrapC e m a
UnwrapC) forall x. Union (Prims m) z x -> z x
Algebra (Prims (UnwrapC e m)) z
alg (ElemOf (UnwrappedEff e) (Derivs m)
-> UnwrappedEff e z a -> Union (Derivs m) z a
forall (z :: * -> *) (m :: * -> *) (e :: Effect) (r :: [Effect]) a.
Coercible z m =>
ElemOf e r -> e z a -> Union r m a
Union ElemOf (UnwrappedEff e) (Derivs m)
forall k (e :: k) (r :: [k]). Member e r => ElemOf e r
membership (e z a -> UnwrappedEff e z a
forall (e :: Effect) (z :: * -> *) x.
EffNewtype e =>
e z x -> UnwrappedEff e z x
unwrapped e z a
e))
  {-# INLINEABLE reformulate #-}

  algDerivs :: Algebra' (Derivs (UnwrapC e m)) (UnwrapC e m) a
algDerivs = Algebra' (Derivs m) (UnwrapC e m) a
-> (forall (z :: * -> *).
    Coercible z (UnwrapC e m) =>
    e z a -> UnwrapC e m a)
-> Algebra' (e : Derivs m) (UnwrapC e m) a
forall (e :: Effect) (r :: [Effect]) (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) (UnwrapC 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 (UnwrapC e m) =>
  e z a -> UnwrapC e m a)
 -> Algebra' (e : Derivs m) (UnwrapC e m) a)
-> (forall (z :: * -> *).
    Coercible z (UnwrapC e m) =>
    e z a -> UnwrapC e m a)
-> Algebra' (e : Derivs m) (UnwrapC e m) a
forall a b. (a -> b) -> a -> b
$
    \e z a
e -> Algebra' (Derivs m) m a -> Algebra' (Derivs m) (UnwrapC e m) a
forall (n :: * -> *) (m :: * -> *) (e :: Effect) 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 (UnwrappedEff e) (Derivs m)
-> UnwrappedEff e z a -> Union (Derivs m) (UnwrapC e m) a
forall (z :: * -> *) (m :: * -> *) (e :: Effect) (r :: [Effect]) a.
Coercible z m =>
ElemOf e r -> e z a -> Union r m a
Union ElemOf (UnwrappedEff e) (Derivs m)
forall k (e :: k) (r :: [k]). Member e r => ElemOf e r
membership (e z a -> UnwrappedEff e z a
forall (e :: Effect) (z :: * -> *) x.
EffNewtype e =>
e z x -> UnwrappedEff e z x
unwrapped e z a
e))
  {-# INLINEABLE algDerivs #-}

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

instance ( IntroConsistent '[] '[UnwrappedEff e] m
         , EffNewtype e
         , Carrier m
         )
      => Carrier (UnwrapTopC e m) where
  type Derivs (UnwrapTopC e m) = e ': StripPrefix '[UnwrappedEff e] (Derivs m)
  type Prims  (UnwrapTopC e m) = Prims m

  algPrims :: Algebra' (Prims (UnwrapTopC e m)) (UnwrapTopC e m) a
algPrims = (Union (Prims m) m a -> m a)
-> Algebra' (Prims m) (UnwrapTopC e m) a
coerce (forall a. Carrier m => Algebra' (Prims m) m a
forall (m :: * -> *) a. Carrier m => Algebra' (Prims m) m a
algPrims @m)
  {-# INLINEABLE algPrims #-}

  reformulate :: Reformulation'
  (Derivs (UnwrapTopC e m))
  (Prims (UnwrapTopC e m))
  (UnwrapTopC e m)
  z
  a
reformulate forall x. UnwrapTopC e m x -> z x
n Algebra (Prims (UnwrapTopC e m)) z
alg = Algebra' (StripPrefix '[UnwrappedEff e] (Derivs m)) z a
-> (forall (z :: * -> *). Coercible z z => e z a -> z a)
-> Algebra' (e : StripPrefix '[UnwrappedEff e] (Derivs m)) z a
forall (e :: Effect) (r :: [Effect]) (m :: * -> *) a.
Algebra' r m a
-> (forall (z :: * -> *). Coercible z m => e z a -> m a)
-> Algebra' (e : r) m a
powerAlg' (Algebra'
  (UnwrappedEff e : StripPrefix '[UnwrappedEff e] (Derivs m)) z a
-> Algebra' (StripPrefix '[UnwrappedEff e] (Derivs m)) z a
forall (e :: Effect) (r :: [Effect]) (m :: * -> *) a.
Algebra' (e : r) m a -> Algebra' r m a
weakenAlg (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 (UnwrapTopC e m x -> z x
forall x. UnwrapTopC e m x -> z x
n (UnwrapTopC e m x -> z x)
-> (m x -> UnwrapTopC e m x) -> m x -> z x
forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# m x -> UnwrapTopC e m x
forall (e :: Effect) (m :: * -> *) a. m a -> UnwrapTopC e m a
UnwrapTopC) forall x. Union (Prims m) z x -> z x
Algebra (Prims (UnwrapTopC e m)) z
alg)) ((forall (z :: * -> *). Coercible z z => e z a -> z a)
 -> Algebra' (e : StripPrefix '[UnwrappedEff e] (Derivs m)) z a)
-> (forall (z :: * -> *). Coercible z z => e z a -> z a)
-> Algebra' (e : StripPrefix '[UnwrappedEff 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 (UnwrapTopC e m x -> z x
forall x. UnwrapTopC e m x -> z x
n (UnwrapTopC e m x -> z x)
-> (m x -> UnwrapTopC e m x) -> m x -> z x
forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# m x -> UnwrapTopC e m x
forall (e :: Effect) (m :: * -> *) a. m a -> UnwrapTopC e m a
UnwrapTopC) forall x. Union (Prims m) z x -> z x
Algebra (Prims (UnwrapTopC e m)) z
alg (ElemOf
  (UnwrappedEff e)
  (UnwrappedEff e : StripPrefix '[UnwrappedEff e] (Derivs m))
-> UnwrappedEff e z a
-> Union
     (UnwrappedEff e : StripPrefix '[UnwrappedEff e] (Derivs m)) z a
forall (z :: * -> *) (m :: * -> *) (e :: Effect) (r :: [Effect]) a.
Coercible z m =>
ElemOf e r -> e z a -> Union r m a
Union ElemOf
  (UnwrappedEff e)
  (UnwrappedEff e : StripPrefix '[UnwrappedEff e] (Derivs m))
forall a (e :: a) (r :: [a]). ElemOf e (e : r)
Here (e z a -> UnwrappedEff e z a
forall (e :: Effect) (z :: * -> *) x.
EffNewtype e =>
e z x -> UnwrappedEff e z x
unwrapped e z a
e))
  {-# INLINEABLE reformulate #-}

  algDerivs :: Algebra' (Derivs (UnwrapTopC e m)) (UnwrapTopC e m) a
algDerivs = Algebra'
  (StripPrefix '[UnwrappedEff e] (Derivs m)) (UnwrapTopC e m) a
-> (forall (z :: * -> *).
    Coercible z (UnwrapTopC e m) =>
    e z a -> UnwrapTopC e m a)
-> Algebra'
     (e : StripPrefix '[UnwrappedEff e] (Derivs m)) (UnwrapTopC e m) a
forall (e :: Effect) (r :: [Effect]) (m :: * -> *) a.
Algebra' r m a
-> (forall (z :: * -> *). Coercible z m => e z a -> m a)
-> Algebra' (e : r) m a
powerAlg' (Algebra'
  (UnwrappedEff e : StripPrefix '[UnwrappedEff e] (Derivs m))
  (UnwrapTopC e m)
  a
-> Algebra'
     (StripPrefix '[UnwrappedEff e] (Derivs m)) (UnwrapTopC e m) a
forall (e :: Effect) (r :: [Effect]) (m :: * -> *) a.
Algebra' (e : r) m a -> Algebra' r m a
weakenAlg (Algebra'
  (UnwrappedEff e : StripPrefix '[UnwrappedEff e] (Derivs m)) m a
-> Algebra'
     (UnwrappedEff e : StripPrefix '[UnwrappedEff e] (Derivs m))
     (UnwrapTopC 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 (UnwrapTopC e m) =>
  e z a -> UnwrapTopC e m a)
 -> Algebra'
      (e : StripPrefix '[UnwrappedEff e] (Derivs m)) (UnwrapTopC e m) a)
-> (forall (z :: * -> *).
    Coercible z (UnwrapTopC e m) =>
    e z a -> UnwrapTopC e m a)
-> Algebra'
     (e : StripPrefix '[UnwrappedEff e] (Derivs m)) (UnwrapTopC e m) a
forall a b. (a -> b) -> a -> b
$
    \e z a
e -> Algebra'
  (UnwrappedEff e : StripPrefix '[UnwrappedEff e] (Derivs m)) m a
-> Algebra'
     (UnwrappedEff e : StripPrefix '[UnwrappedEff e] (Derivs m))
     (UnwrapTopC e m)
     a
forall (n :: * -> *) (m :: * -> *) (e :: Effect) 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
  (UnwrappedEff e)
  (UnwrappedEff e : StripPrefix '[UnwrappedEff e] (Derivs m))
-> UnwrappedEff e z a
-> Union
     (UnwrappedEff e : StripPrefix '[UnwrappedEff e] (Derivs m))
     (UnwrapTopC e m)
     a
forall (z :: * -> *) (m :: * -> *) (e :: Effect) (r :: [Effect]) a.
Coercible z m =>
ElemOf e r -> e z a -> Union r m a
Union ElemOf
  (UnwrappedEff e)
  (UnwrappedEff e : StripPrefix '[UnwrappedEff e] (Derivs m))
forall a (e :: a) (r :: [a]). ElemOf e (e : r)
Here (e z a -> UnwrappedEff e z a
forall (e :: Effect) (z :: * -> *) x.
EffNewtype e =>
e z x -> UnwrappedEff e z x
unwrapped e z a
e))
  {-# INLINEABLE algDerivs #-}



-- | Unwrap uses of an effect
unwrap :: forall e m a
        . ( Carrier m
          , Member (UnwrappedEff e) (Derivs m)
          , EffNewtype e
          )
       => UnwrapC e m a
       -> m a
unwrap :: UnwrapC e m a -> m a
unwrap = UnwrapC e m a -> m a
forall (e :: Effect) (m :: * -> *) a. UnwrapC e m a -> m a
unUnwrapC
{-# INLINE unwrap #-}

-- | Unwrap uses of an effect, placing its unwrapped version on top
-- of the effect stack.
unwrapTop :: forall e m a
           . ( HeadEff (UnwrappedEff e) m
             , EffNewtype e
             , Carrier m
             )
          => UnwrapTopC e m a
          -> m a
unwrapTop :: UnwrapTopC e m a -> m a
unwrapTop = UnwrapTopC e m a -> m a
forall (e :: Effect) (m :: * -> *) a. UnwrapTopC e m a -> m a
unUnwrapTopC
{-# INLINE unwrapTop #-}

class EffNewtype (e :: Effect) where
  type UnwrappedEff e :: Effect
  unwrapped :: e z x -> UnwrappedEff e z x
  default unwrapped :: Coercible e (UnwrappedEff e) => e z x -> UnwrappedEff e z x
  unwrapped = e z x -> UnwrappedEff e z x
coerce
  {-# INLINE unwrapped #-}

-- | Useful for deriving instances of 'EffNewtype'.
--
-- @
-- newtype SomeWrapper m a = SomeWrapper (SomeEffect m a)
--   deriving 'EffNewtype' via SomeWrapper \`'WrapperOf'\` SomeEffect
-- @
newtype WrapperOf (e :: Effect) (e' :: Effect) m a = WrapperOf (e m a)

instance Coercible e e' => EffNewtype (WrapperOf e e') where
  type UnwrappedEff (WrapperOf e e') = e'