{-# OPTIONS_HADDOCK not-home #-}
{-# LANGUAGE DerivingVia #-}
module Control.Effect.Internal.Error where

import Data.Coerce

import Control.Applicative
import Control.Monad

import Control.Effect
import Control.Effect.Type.Throw
import Control.Effect.Type.Catch
import Control.Effect.Optional

import Control.Effect.Carrier

import Control.Monad.Trans.Except

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

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

instance ( Carrier m
         , Threads (ExceptT e) (Prims m)
         )
      => Carrier (ThrowC e m) where
  type Derivs (ThrowC e m) = Throw e ': Derivs m
  type Prims  (ThrowC e m) = Prims m

  algPrims :: Algebra' (Prims (ThrowC e m)) (ThrowC e m) a
algPrims = (Union (Prims m) (ExceptT e m) a -> ExceptT e m a)
-> Algebra' (Prims m) (ThrowC e m) a
coerce (Algebra (Prims m) m -> Algebra (Prims m) (ExceptT e m)
forall (t :: (* -> *) -> * -> *) (p :: [(* -> *) -> * -> *])
       (m :: * -> *).
(Threads t p, Monad m) =>
Algebra p m -> Algebra p (t m)
thread @(ExceptT e) (Carrier m => Algebra (Prims m) m
forall (m :: * -> *) a. Carrier m => Algebra' (Prims m) m a
algPrims @m))
  {-# INLINEABLE algPrims #-}

  reformulate :: Reformulation'
  (Derivs (ThrowC e m)) (Prims (ThrowC e m)) (ThrowC e m) z a
reformulate forall x. ThrowC e m x -> z x
n Algebra (Prims (ThrowC e m)) z
alg = Algebra' (Derivs m) z a
-> (Throw e z a -> z a) -> Algebra' (Throw e : Derivs m) z a
forall (e :: (* -> *) -> * -> *) (r :: [(* -> *) -> * -> *])
       (m :: * -> *) a.
RepresentationalEff e =>
Algebra' r m a -> (e m 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 (ThrowC e m x -> z x
forall x. ThrowC e m x -> z x
n (ThrowC e m x -> z x) -> (m x -> ThrowC e m x) -> m x -> z x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m x -> ThrowC e m x
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift) forall x. Union (Prims m) z x -> z x
Algebra (Prims (ThrowC e m)) z
alg) ((Throw e z a -> z a) -> Algebra' (Throw e : Derivs m) z a)
-> (Throw e z a -> z a) -> Algebra' (Throw e : Derivs m) z a
forall a b. (a -> b) -> a -> b
$ \case
    Throw e
e -> ThrowC e m a -> z a
forall x. ThrowC e m x -> z x
n (ExceptT e m a -> ThrowC e m a
forall e (m :: * -> *) a. ExceptT e m a -> ThrowC e m a
ThrowC (e -> ExceptT e m a
forall (m :: * -> *) e a. Monad m => e -> ExceptT e m a
throwE e
e))
  {-# INLINEABLE reformulate #-}


instance ( Carrier m
         , Threads (ExceptT e) (Prims m)
         )
      => Carrier (ErrorC e m) where
  type Derivs (ErrorC e m) = Catch e ': Throw e ': Derivs m
  type Prims  (ErrorC e m) = Optional ((->) e) ': Prims m

  algPrims :: Algebra' (Prims (ErrorC e m)) (ErrorC e m) a
algPrims = Algebra' (Prims m) (ErrorC e m) a
-> (Optional ((->) e) (ErrorC e m) a -> ErrorC e m a)
-> Algebra' (Optional ((->) e) : Prims m) (ErrorC e m) a
forall (e :: (* -> *) -> * -> *) (r :: [(* -> *) -> * -> *])
       (m :: * -> *) a.
RepresentationalEff e =>
Algebra' r m a -> (e m a -> m a) -> Algebra' (e : r) m a
powerAlg (Algebra' (Prims m) (ThrowC e m) a
-> Algebra' (Prims m) (ErrorC e m) a
coerce (forall a.
Carrier (ThrowC e m) =>
Algebra' (Prims (ThrowC e m)) (ThrowC e m) a
forall (m :: * -> *) a. Carrier m => Algebra' (Prims m) m a
algPrims @(ThrowC e m))) ((Optional ((->) e) (ErrorC e m) a -> ErrorC e m a)
 -> Algebra' (Optional ((->) e) : Prims m) (ErrorC e m) a)
-> (Optional ((->) e) (ErrorC e m) a -> ErrorC e m a)
-> Algebra' (Optional ((->) e) : Prims m) (ErrorC e m) a
forall a b. (a -> b) -> a -> b
$ \case
    Optionally e -> a
h ErrorC e m a
m -> ExceptT e m a -> ErrorC e m a
forall e (m :: * -> *) a. ExceptT e m a -> ErrorC e m a
ErrorC (ErrorC e m a -> ExceptT e m a
forall e (m :: * -> *) a. ErrorC e m a -> ExceptT e m a
unErrorC ErrorC e m a
m ExceptT e m a -> (e -> ExceptT e m a) -> ExceptT e m a
forall (m :: * -> *) e a e'.
Monad m =>
ExceptT e m a -> (e -> ExceptT e' m a) -> ExceptT e' m a
`catchE` (a -> ExceptT e m a
forall (m :: * -> *) a. Monad m => a -> m a
return (a -> ExceptT e m a) -> (e -> a) -> e -> ExceptT e m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. e -> a
h))
  {-# INLINEABLE algPrims #-}

  reformulate :: Reformulation'
  (Derivs (ErrorC e m)) (Prims (ErrorC e m)) (ErrorC e m) z a
reformulate forall x. ErrorC e m x -> z x
n Algebra (Prims (ErrorC e m)) z
alg =
    Algebra' (Throw e : Derivs m) z a
-> (Catch e z a -> z a)
-> Algebra' (Catch e : Throw e : Derivs m) z a
forall (e :: (* -> *) -> * -> *) (r :: [(* -> *) -> * -> *])
       (m :: * -> *) a.
RepresentationalEff e =>
Algebra' r m a -> (e m a -> m a) -> Algebra' (e : r) m a
powerAlg (
      Reformulation' (Throw e : Derivs m) (Prims m) (ThrowC e m) z a
-> Reformulation' (Throw e : Derivs m) (Prims m) (ErrorC e m) z a
forall (m :: * -> *) (n :: * -> *) (r :: [(* -> *) -> * -> *])
       (p :: [(* -> *) -> * -> *]) (z :: * -> *) a.
Coercible m n =>
Reformulation' r p m z a -> Reformulation' r p n z a
coerceReform (forall (z :: * -> *) a.
(Carrier (ThrowC e m), Monad z) =>
Reformulation'
  (Derivs (ThrowC e m)) (Prims (ThrowC e m)) (ThrowC e m) z a
forall (m :: * -> *) (z :: * -> *) a.
(Carrier m, Monad z) =>
Reformulation' (Derivs m) (Prims m) m z a
reformulate @(ThrowC e m)) forall x. ErrorC e m x -> z x
n (Algebra' (Optional ((->) e) : Prims m) z x
-> Algebra' (Prims m) z x
forall (e :: (* -> *) -> * -> *) (r :: [(* -> *) -> * -> *])
       (m :: * -> *) a.
Algebra' (e : r) m a -> Algebra' r m a
weakenAlg Algebra' (Optional ((->) e) : Prims m) z x
Algebra (Prims (ErrorC e m)) z
alg)
    ) ((Catch e z a -> z a)
 -> Algebra' (Catch e : Throw e : Derivs m) z a)
-> (Catch e z a -> z a)
-> Algebra' (Catch e : Throw e : Derivs m) z a
forall a b. (a -> b) -> a -> b
$ \case
      Catch z a
m e -> z a
h -> z (z a) -> z a
forall (m :: * -> *) a. Monad m => m (m a) -> m a
join (z (z a) -> z a) -> z (z a) -> z a
forall a b. (a -> b) -> a -> b
$ (Union (Optional ((->) e) : Prims m) z (z a) -> z (z a)
Algebra (Prims (ErrorC e m)) z
alg (Union (Optional ((->) e) : Prims m) z (z a) -> z (z a))
-> (Optional ((->) e) z (z a)
    -> Union (Optional ((->) e) : Prims m) z (z a))
-> Optional ((->) e) z (z a)
-> z (z a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Optional ((->) e) z (z a)
-> Union (Optional ((->) e) : Prims m) z (z a)
forall (e :: (* -> *) -> * -> *) (r :: [(* -> *) -> * -> *])
       (m :: * -> *) a.
Member e r =>
e m a -> Union r m a
inj) (Optional ((->) e) z (z a) -> z (z a))
-> Optional ((->) e) z (z a) -> z (z a)
forall a b. (a -> b) -> a -> b
$ (e -> z a) -> z (z a) -> Optional ((->) e) z (z a)
forall (s :: * -> *) a (m :: * -> *). s a -> m a -> Optional s m a
Optionally e -> z a
h ((a -> z a) -> z a -> z (z a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> z a
forall (f :: * -> *) a. Applicative f => a -> f a
pure z a
m)
  {-# INLINEABLE reformulate #-}


-- | 'ErrorThreads' accepts the following primitive effects:
--
-- * 'Control.Effect.Regional.Regional' @s@
-- * 'Control.Effect.Optional.Optional' @s@ (when @s@ is a functor)
-- * 'Control.Effect.BaseControl.BaseControl' @b@
-- * 'Control.Effect.Type.Unravel.Unravel' @p@
-- * 'Control.Effect.Type.ListenPrim.ListenPrim' @o@ (when @o@ is a 'Monoid')
-- * 'Control.Effect.Type.WriterPrim.WriterPrim' @o@ (when @o@ is a 'Monoid')
-- * 'Control.Effect.Type.ReaderPrim.ReaderPrim' @i@
-- * 'Control.Effect.Mask.Mask'
-- * 'Control.Effect.Bracket.Bracket'
-- * 'Control.Effect.Fix.Fix'
class    ( forall e. Threads (ExceptT e) p
         ) => ErrorThreads p
instance ( forall e. Threads (ExceptT e) p
         ) => ErrorThreads p