{-# LANGUAGE DerivingVia #-}
{-# OPTIONS_HADDOCK not-home #-}
module Control.Effect.Internal.ErrorIO where
import Control.Monad
import Control.Effect
import Control.Effect.Optional
import Control.Effect.Type.ErrorIO
import Control.Exception (SomeException)
import qualified Control.Exception as X
import qualified Control.Monad.Catch as C
import Control.Effect.Internal.Derive
import Control.Effect.Carrier.Internal.Intro
import Control.Effect.Carrier.Internal.Compose
import Control.Effect.Carrier.Internal.Interpret
import Control.Effect.Internal.Utils
newtype ErrorIOToIOC m a = ErrorIOToIOC {
ErrorIOToIOC m a
-> ReinterpretC
ErrorIOFinalH
ErrorIO
'[Optional ((->) SomeException)]
(InterpretPrimC ErrorIOFinalH (Optional ((->) SomeException)) m)
a
unErrorIOToIOC ::
ReinterpretC ErrorIOFinalH ErrorIO
'[Optional ((->) SomeException)]
( InterpretPrimC ErrorIOFinalH (Optional ((->) SomeException))
( m
)) a
} deriving ( a -> ErrorIOToIOC m b -> ErrorIOToIOC m a
(a -> b) -> ErrorIOToIOC m a -> ErrorIOToIOC m b
(forall a b. (a -> b) -> ErrorIOToIOC m a -> ErrorIOToIOC m b)
-> (forall a b. a -> ErrorIOToIOC m b -> ErrorIOToIOC m a)
-> Functor (ErrorIOToIOC m)
forall a b. a -> ErrorIOToIOC m b -> ErrorIOToIOC m a
forall a b. (a -> b) -> ErrorIOToIOC m a -> ErrorIOToIOC m b
forall (m :: * -> *) a b.
Functor m =>
a -> ErrorIOToIOC m b -> ErrorIOToIOC m a
forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> ErrorIOToIOC m a -> ErrorIOToIOC m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> ErrorIOToIOC m b -> ErrorIOToIOC m a
$c<$ :: forall (m :: * -> *) a b.
Functor m =>
a -> ErrorIOToIOC m b -> ErrorIOToIOC m a
fmap :: (a -> b) -> ErrorIOToIOC m a -> ErrorIOToIOC m b
$cfmap :: forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> ErrorIOToIOC m a -> ErrorIOToIOC m b
Functor, Functor (ErrorIOToIOC m)
a -> ErrorIOToIOC m a
Functor (ErrorIOToIOC m)
-> (forall a. a -> ErrorIOToIOC m a)
-> (forall a b.
ErrorIOToIOC m (a -> b) -> ErrorIOToIOC m a -> ErrorIOToIOC m b)
-> (forall a b c.
(a -> b -> c)
-> ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m c)
-> (forall a b.
ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m b)
-> (forall a b.
ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m a)
-> Applicative (ErrorIOToIOC m)
ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m b
ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m a
ErrorIOToIOC m (a -> b) -> ErrorIOToIOC m a -> ErrorIOToIOC m b
(a -> b -> c)
-> ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m c
forall a. a -> ErrorIOToIOC m a
forall a b.
ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m a
forall a b.
ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m b
forall a b.
ErrorIOToIOC m (a -> b) -> ErrorIOToIOC m a -> ErrorIOToIOC m b
forall a b c.
(a -> b -> c)
-> ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
forall (m :: * -> *). Applicative m => Functor (ErrorIOToIOC m)
forall (m :: * -> *) a. Applicative m => a -> ErrorIOToIOC m a
forall (m :: * -> *) a b.
Applicative m =>
ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m a
forall (m :: * -> *) a b.
Applicative m =>
ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m b
forall (m :: * -> *) a b.
Applicative m =>
ErrorIOToIOC m (a -> b) -> ErrorIOToIOC m a -> ErrorIOToIOC m b
forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m c
<* :: ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m a
$c<* :: forall (m :: * -> *) a b.
Applicative m =>
ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m a
*> :: ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m b
$c*> :: forall (m :: * -> *) a b.
Applicative m =>
ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m b
liftA2 :: (a -> b -> c)
-> ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m c
$cliftA2 :: forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m c
<*> :: ErrorIOToIOC m (a -> b) -> ErrorIOToIOC m a -> ErrorIOToIOC m b
$c<*> :: forall (m :: * -> *) a b.
Applicative m =>
ErrorIOToIOC m (a -> b) -> ErrorIOToIOC m a -> ErrorIOToIOC m b
pure :: a -> ErrorIOToIOC m a
$cpure :: forall (m :: * -> *) a. Applicative m => a -> ErrorIOToIOC m a
$cp1Applicative :: forall (m :: * -> *). Applicative m => Functor (ErrorIOToIOC m)
Applicative, Applicative (ErrorIOToIOC m)
a -> ErrorIOToIOC m a
Applicative (ErrorIOToIOC m)
-> (forall a b.
ErrorIOToIOC m a -> (a -> ErrorIOToIOC m b) -> ErrorIOToIOC m b)
-> (forall a b.
ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m b)
-> (forall a. a -> ErrorIOToIOC m a)
-> Monad (ErrorIOToIOC m)
ErrorIOToIOC m a -> (a -> ErrorIOToIOC m b) -> ErrorIOToIOC m b
ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m b
forall a. a -> ErrorIOToIOC m a
forall a b.
ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m b
forall a b.
ErrorIOToIOC m a -> (a -> ErrorIOToIOC m b) -> ErrorIOToIOC m b
forall (m :: * -> *). Monad m => Applicative (ErrorIOToIOC m)
forall (m :: * -> *) a. Monad m => a -> ErrorIOToIOC m a
forall (m :: * -> *) a b.
Monad m =>
ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m b
forall (m :: * -> *) a b.
Monad m =>
ErrorIOToIOC m a -> (a -> ErrorIOToIOC m b) -> ErrorIOToIOC 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 -> ErrorIOToIOC m a
$creturn :: forall (m :: * -> *) a. Monad m => a -> ErrorIOToIOC m a
>> :: ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m b
$c>> :: forall (m :: * -> *) a b.
Monad m =>
ErrorIOToIOC m a -> ErrorIOToIOC m b -> ErrorIOToIOC m b
>>= :: ErrorIOToIOC m a -> (a -> ErrorIOToIOC m b) -> ErrorIOToIOC m b
$c>>= :: forall (m :: * -> *) a b.
Monad m =>
ErrorIOToIOC m a -> (a -> ErrorIOToIOC m b) -> ErrorIOToIOC m b
$cp1Monad :: forall (m :: * -> *). Monad m => Applicative (ErrorIOToIOC m)
Monad
, Applicative (ErrorIOToIOC m)
ErrorIOToIOC m a
Applicative (ErrorIOToIOC m)
-> (forall a. ErrorIOToIOC m a)
-> (forall a.
ErrorIOToIOC m a -> ErrorIOToIOC m a -> ErrorIOToIOC m a)
-> (forall a. ErrorIOToIOC m a -> ErrorIOToIOC m [a])
-> (forall a. ErrorIOToIOC m a -> ErrorIOToIOC m [a])
-> Alternative (ErrorIOToIOC m)
ErrorIOToIOC m a -> ErrorIOToIOC m a -> ErrorIOToIOC m a
ErrorIOToIOC m a -> ErrorIOToIOC m [a]
ErrorIOToIOC m a -> ErrorIOToIOC m [a]
forall a. ErrorIOToIOC m a
forall a. ErrorIOToIOC m a -> ErrorIOToIOC m [a]
forall a. ErrorIOToIOC m a -> ErrorIOToIOC m a -> ErrorIOToIOC m a
forall (f :: * -> *).
Applicative f
-> (forall a. f a)
-> (forall a. f a -> f a -> f a)
-> (forall a. f a -> f [a])
-> (forall a. f a -> f [a])
-> Alternative f
forall (m :: * -> *). Alternative m => Applicative (ErrorIOToIOC m)
forall (m :: * -> *) a. Alternative m => ErrorIOToIOC m a
forall (m :: * -> *) a.
Alternative m =>
ErrorIOToIOC m a -> ErrorIOToIOC m [a]
forall (m :: * -> *) a.
Alternative m =>
ErrorIOToIOC m a -> ErrorIOToIOC m a -> ErrorIOToIOC m a
many :: ErrorIOToIOC m a -> ErrorIOToIOC m [a]
$cmany :: forall (m :: * -> *) a.
Alternative m =>
ErrorIOToIOC m a -> ErrorIOToIOC m [a]
some :: ErrorIOToIOC m a -> ErrorIOToIOC m [a]
$csome :: forall (m :: * -> *) a.
Alternative m =>
ErrorIOToIOC m a -> ErrorIOToIOC m [a]
<|> :: ErrorIOToIOC m a -> ErrorIOToIOC m a -> ErrorIOToIOC m a
$c<|> :: forall (m :: * -> *) a.
Alternative m =>
ErrorIOToIOC m a -> ErrorIOToIOC m a -> ErrorIOToIOC m a
empty :: ErrorIOToIOC m a
$cempty :: forall (m :: * -> *) a. Alternative m => ErrorIOToIOC m a
$cp1Alternative :: forall (m :: * -> *). Alternative m => Applicative (ErrorIOToIOC m)
Alternative, Monad (ErrorIOToIOC m)
Alternative (ErrorIOToIOC m)
ErrorIOToIOC m a
Alternative (ErrorIOToIOC m)
-> Monad (ErrorIOToIOC m)
-> (forall a. ErrorIOToIOC m a)
-> (forall a.
ErrorIOToIOC m a -> ErrorIOToIOC m a -> ErrorIOToIOC m a)
-> MonadPlus (ErrorIOToIOC m)
ErrorIOToIOC m a -> ErrorIOToIOC m a -> ErrorIOToIOC m a
forall a. ErrorIOToIOC m a
forall a. ErrorIOToIOC m a -> ErrorIOToIOC m a -> ErrorIOToIOC m a
forall (m :: * -> *).
Alternative m
-> Monad m
-> (forall a. m a)
-> (forall a. m a -> m a -> m a)
-> MonadPlus m
forall (m :: * -> *). MonadPlus m => Monad (ErrorIOToIOC m)
forall (m :: * -> *). MonadPlus m => Alternative (ErrorIOToIOC m)
forall (m :: * -> *) a. MonadPlus m => ErrorIOToIOC m a
forall (m :: * -> *) a.
MonadPlus m =>
ErrorIOToIOC m a -> ErrorIOToIOC m a -> ErrorIOToIOC m a
mplus :: ErrorIOToIOC m a -> ErrorIOToIOC m a -> ErrorIOToIOC m a
$cmplus :: forall (m :: * -> *) a.
MonadPlus m =>
ErrorIOToIOC m a -> ErrorIOToIOC m a -> ErrorIOToIOC m a
mzero :: ErrorIOToIOC m a
$cmzero :: forall (m :: * -> *) a. MonadPlus m => ErrorIOToIOC m a
$cp2MonadPlus :: forall (m :: * -> *). MonadPlus m => Monad (ErrorIOToIOC m)
$cp1MonadPlus :: forall (m :: * -> *). MonadPlus m => Alternative (ErrorIOToIOC m)
MonadPlus
, Monad (ErrorIOToIOC m)
Monad (ErrorIOToIOC m)
-> (forall a. (a -> ErrorIOToIOC m a) -> ErrorIOToIOC m a)
-> MonadFix (ErrorIOToIOC m)
(a -> ErrorIOToIOC m a) -> ErrorIOToIOC m a
forall a. (a -> ErrorIOToIOC m a) -> ErrorIOToIOC m a
forall (m :: * -> *).
Monad m -> (forall a. (a -> m a) -> m a) -> MonadFix m
forall (m :: * -> *). MonadFix m => Monad (ErrorIOToIOC m)
forall (m :: * -> *) a.
MonadFix m =>
(a -> ErrorIOToIOC m a) -> ErrorIOToIOC m a
mfix :: (a -> ErrorIOToIOC m a) -> ErrorIOToIOC m a
$cmfix :: forall (m :: * -> *) a.
MonadFix m =>
(a -> ErrorIOToIOC m a) -> ErrorIOToIOC m a
$cp1MonadFix :: forall (m :: * -> *). MonadFix m => Monad (ErrorIOToIOC m)
MonadFix, Monad (ErrorIOToIOC m)
Monad (ErrorIOToIOC m)
-> (forall a. String -> ErrorIOToIOC m a)
-> MonadFail (ErrorIOToIOC m)
String -> ErrorIOToIOC m a
forall a. String -> ErrorIOToIOC m a
forall (m :: * -> *).
Monad m -> (forall a. String -> m a) -> MonadFail m
forall (m :: * -> *). MonadFail m => Monad (ErrorIOToIOC m)
forall (m :: * -> *) a. MonadFail m => String -> ErrorIOToIOC m a
fail :: String -> ErrorIOToIOC m a
$cfail :: forall (m :: * -> *) a. MonadFail m => String -> ErrorIOToIOC m a
$cp1MonadFail :: forall (m :: * -> *). MonadFail m => Monad (ErrorIOToIOC m)
MonadFail, Monad (ErrorIOToIOC m)
Monad (ErrorIOToIOC m)
-> (forall a. IO a -> ErrorIOToIOC m a) -> MonadIO (ErrorIOToIOC m)
IO a -> ErrorIOToIOC m a
forall a. IO a -> ErrorIOToIOC m a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
forall (m :: * -> *). MonadIO m => Monad (ErrorIOToIOC m)
forall (m :: * -> *) a. MonadIO m => IO a -> ErrorIOToIOC m a
liftIO :: IO a -> ErrorIOToIOC m a
$cliftIO :: forall (m :: * -> *) a. MonadIO m => IO a -> ErrorIOToIOC m a
$cp1MonadIO :: forall (m :: * -> *). MonadIO m => Monad (ErrorIOToIOC m)
MonadIO
, Monad (ErrorIOToIOC m)
e -> ErrorIOToIOC m a
Monad (ErrorIOToIOC m)
-> (forall e a. Exception e => e -> ErrorIOToIOC m a)
-> MonadThrow (ErrorIOToIOC m)
forall e a. Exception e => e -> ErrorIOToIOC m a
forall (m :: * -> *).
Monad m -> (forall e a. Exception e => e -> m a) -> MonadThrow m
forall (m :: * -> *). MonadThrow m => Monad (ErrorIOToIOC m)
forall (m :: * -> *) e a.
(MonadThrow m, Exception e) =>
e -> ErrorIOToIOC m a
throwM :: e -> ErrorIOToIOC m a
$cthrowM :: forall (m :: * -> *) e a.
(MonadThrow m, Exception e) =>
e -> ErrorIOToIOC m a
$cp1MonadThrow :: forall (m :: * -> *). MonadThrow m => Monad (ErrorIOToIOC m)
MonadThrow, MonadThrow (ErrorIOToIOC m)
MonadThrow (ErrorIOToIOC m)
-> (forall e a.
Exception e =>
ErrorIOToIOC m a -> (e -> ErrorIOToIOC m a) -> ErrorIOToIOC m a)
-> MonadCatch (ErrorIOToIOC m)
ErrorIOToIOC m a -> (e -> ErrorIOToIOC m a) -> ErrorIOToIOC m a
forall e a.
Exception e =>
ErrorIOToIOC m a -> (e -> ErrorIOToIOC m a) -> ErrorIOToIOC m a
forall (m :: * -> *).
MonadThrow m
-> (forall e a. Exception e => m a -> (e -> m a) -> m a)
-> MonadCatch m
forall (m :: * -> *). MonadCatch m => MonadThrow (ErrorIOToIOC m)
forall (m :: * -> *) e a.
(MonadCatch m, Exception e) =>
ErrorIOToIOC m a -> (e -> ErrorIOToIOC m a) -> ErrorIOToIOC m a
catch :: ErrorIOToIOC m a -> (e -> ErrorIOToIOC m a) -> ErrorIOToIOC m a
$ccatch :: forall (m :: * -> *) e a.
(MonadCatch m, Exception e) =>
ErrorIOToIOC m a -> (e -> ErrorIOToIOC m a) -> ErrorIOToIOC m a
$cp1MonadCatch :: forall (m :: * -> *). MonadCatch m => MonadThrow (ErrorIOToIOC m)
MonadCatch, MonadCatch (ErrorIOToIOC m)
MonadCatch (ErrorIOToIOC m)
-> (forall b.
((forall a. ErrorIOToIOC m a -> ErrorIOToIOC m a)
-> ErrorIOToIOC m b)
-> ErrorIOToIOC m b)
-> (forall b.
((forall a. ErrorIOToIOC m a -> ErrorIOToIOC m a)
-> ErrorIOToIOC m b)
-> ErrorIOToIOC m b)
-> (forall a b c.
ErrorIOToIOC m a
-> (a -> ExitCase b -> ErrorIOToIOC m c)
-> (a -> ErrorIOToIOC m b)
-> ErrorIOToIOC m (b, c))
-> MonadMask (ErrorIOToIOC m)
ErrorIOToIOC m a
-> (a -> ExitCase b -> ErrorIOToIOC m c)
-> (a -> ErrorIOToIOC m b)
-> ErrorIOToIOC m (b, c)
((forall a. ErrorIOToIOC m a -> ErrorIOToIOC m a)
-> ErrorIOToIOC m b)
-> ErrorIOToIOC m b
((forall a. ErrorIOToIOC m a -> ErrorIOToIOC m a)
-> ErrorIOToIOC m b)
-> ErrorIOToIOC m b
forall b.
((forall a. ErrorIOToIOC m a -> ErrorIOToIOC m a)
-> ErrorIOToIOC m b)
-> ErrorIOToIOC m b
forall a b c.
ErrorIOToIOC m a
-> (a -> ExitCase b -> ErrorIOToIOC m c)
-> (a -> ErrorIOToIOC m b)
-> ErrorIOToIOC m (b, c)
forall (m :: * -> *).
MonadCatch m
-> (forall b. ((forall a. m a -> m a) -> m b) -> m b)
-> (forall b. ((forall a. m a -> m a) -> m b) -> m b)
-> (forall a b c.
m a -> (a -> ExitCase b -> m c) -> (a -> m b) -> m (b, c))
-> MonadMask m
forall (m :: * -> *). MonadMask m => MonadCatch (ErrorIOToIOC m)
forall (m :: * -> *) b.
MonadMask m =>
((forall a. ErrorIOToIOC m a -> ErrorIOToIOC m a)
-> ErrorIOToIOC m b)
-> ErrorIOToIOC m b
forall (m :: * -> *) a b c.
MonadMask m =>
ErrorIOToIOC m a
-> (a -> ExitCase b -> ErrorIOToIOC m c)
-> (a -> ErrorIOToIOC m b)
-> ErrorIOToIOC m (b, c)
generalBracket :: ErrorIOToIOC m a
-> (a -> ExitCase b -> ErrorIOToIOC m c)
-> (a -> ErrorIOToIOC m b)
-> ErrorIOToIOC m (b, c)
$cgeneralBracket :: forall (m :: * -> *) a b c.
MonadMask m =>
ErrorIOToIOC m a
-> (a -> ExitCase b -> ErrorIOToIOC m c)
-> (a -> ErrorIOToIOC m b)
-> ErrorIOToIOC m (b, c)
uninterruptibleMask :: ((forall a. ErrorIOToIOC m a -> ErrorIOToIOC m a)
-> ErrorIOToIOC m b)
-> ErrorIOToIOC m b
$cuninterruptibleMask :: forall (m :: * -> *) b.
MonadMask m =>
((forall a. ErrorIOToIOC m a -> ErrorIOToIOC m a)
-> ErrorIOToIOC m b)
-> ErrorIOToIOC m b
mask :: ((forall a. ErrorIOToIOC m a -> ErrorIOToIOC m a)
-> ErrorIOToIOC m b)
-> ErrorIOToIOC m b
$cmask :: forall (m :: * -> *) b.
MonadMask m =>
((forall a. ErrorIOToIOC m a -> ErrorIOToIOC m a)
-> ErrorIOToIOC m b)
-> ErrorIOToIOC m b
$cp1MonadMask :: forall (m :: * -> *). MonadMask m => MonadCatch (ErrorIOToIOC m)
MonadMask
, MonadBase b, MonadBaseControl b
)
deriving (m a -> ErrorIOToIOC m a
(forall (m :: * -> *) a. Monad m => m a -> ErrorIOToIOC m a)
-> MonadTrans ErrorIOToIOC
forall (m :: * -> *) a. Monad m => m a -> ErrorIOToIOC m a
forall (t :: (* -> *) -> * -> *).
(forall (m :: * -> *) a. Monad m => m a -> t m a) -> MonadTrans t
lift :: m a -> ErrorIOToIOC m a
$clift :: forall (m :: * -> *) a. Monad m => m a -> ErrorIOToIOC m a
MonadTrans, MonadTrans ErrorIOToIOC
m (StT ErrorIOToIOC a) -> ErrorIOToIOC m a
MonadTrans ErrorIOToIOC
-> (forall (m :: * -> *) a.
Monad m =>
(Run ErrorIOToIOC -> m a) -> ErrorIOToIOC m a)
-> (forall (m :: * -> *) a.
Monad m =>
m (StT ErrorIOToIOC a) -> ErrorIOToIOC m a)
-> MonadTransControl ErrorIOToIOC
(Run ErrorIOToIOC -> m a) -> ErrorIOToIOC m a
forall (m :: * -> *) a.
Monad m =>
m (StT ErrorIOToIOC a) -> ErrorIOToIOC m a
forall (m :: * -> *) a.
Monad m =>
(Run ErrorIOToIOC -> m a) -> ErrorIOToIOC 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 ErrorIOToIOC a) -> ErrorIOToIOC m a
$crestoreT :: forall (m :: * -> *) a.
Monad m =>
m (StT ErrorIOToIOC a) -> ErrorIOToIOC m a
liftWith :: (Run ErrorIOToIOC -> m a) -> ErrorIOToIOC m a
$cliftWith :: forall (m :: * -> *) a.
Monad m =>
(Run ErrorIOToIOC -> m a) -> ErrorIOToIOC m a
$cp1MonadTransControl :: MonadTrans ErrorIOToIOC
MonadTransControl)
via CompositionBaseT
'[ ReinterpretC ErrorIOFinalH ErrorIO
'[Optional ((->) SomeException)]
, InterpretPrimC ErrorIOFinalH (Optional ((->) SomeException))
]
deriving instance (Carrier m, C.MonadCatch m)
=> Carrier (ErrorIOToIOC m)
errorIOToIO :: (Carrier m, C.MonadCatch m)
=> ErrorIOToIOC m a
-> m a
errorIOToIO :: ErrorIOToIOC m a -> m a
errorIOToIO =
InterpretPrimC ErrorIOFinalH (Optional ((->) SomeException)) m a
-> m a
forall h (e :: (* -> *) -> * -> *) (m :: * -> *) a.
PrimHandler h e m =>
InterpretPrimC h e m a -> m a
interpretPrimViaHandler
(InterpretPrimC ErrorIOFinalH (Optional ((->) SomeException)) m a
-> m a)
-> (ReinterpretC
ErrorIOFinalH
ErrorIO
'[Optional ((->) SomeException)]
(InterpretPrimC ErrorIOFinalH (Optional ((->) SomeException)) m)
a
-> InterpretPrimC
ErrorIOFinalH (Optional ((->) SomeException)) m a)
-> ReinterpretC
ErrorIOFinalH
ErrorIO
'[Optional ((->) SomeException)]
(InterpretPrimC ErrorIOFinalH (Optional ((->) SomeException)) m)
a
-> m a
forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# ReinterpretC
ErrorIOFinalH
ErrorIO
'[Optional ((->) SomeException)]
(InterpretPrimC ErrorIOFinalH (Optional ((->) SomeException)) m)
a
-> InterpretPrimC ErrorIOFinalH (Optional ((->) SomeException)) m a
forall h (e :: (* -> *) -> * -> *) (new :: [(* -> *) -> * -> *])
(m :: * -> *) a.
(Handler h e m, KnownList new, HeadEffs new m) =>
ReinterpretC h e new m a -> m a
reinterpretViaHandler
(ReinterpretC
ErrorIOFinalH
ErrorIO
'[Optional ((->) SomeException)]
(InterpretPrimC ErrorIOFinalH (Optional ((->) SomeException)) m)
a
-> m a)
-> (ErrorIOToIOC m a
-> ReinterpretC
ErrorIOFinalH
ErrorIO
'[Optional ((->) SomeException)]
(InterpretPrimC ErrorIOFinalH (Optional ((->) SomeException)) m)
a)
-> ErrorIOToIOC m a
-> m a
forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# ErrorIOToIOC m a
-> ReinterpretC
ErrorIOFinalH
ErrorIO
'[Optional ((->) SomeException)]
(InterpretPrimC ErrorIOFinalH (Optional ((->) SomeException)) m)
a
forall (m :: * -> *) a.
ErrorIOToIOC m a
-> ReinterpretC
ErrorIOFinalH
ErrorIO
'[Optional ((->) SomeException)]
(InterpretPrimC ErrorIOFinalH (Optional ((->) SomeException)) m)
a
unErrorIOToIOC
{-# INLINE errorIOToIO #-}
data ErrorIOFinalH
instance ( C.MonadThrow m
, Eff (Optional ((->) SomeException)) m
)
=> Handler ErrorIOFinalH ErrorIO m where
effHandler :: ErrorIO (Effly z) x -> Effly z x
effHandler = \case
ThrowIO e
x -> m x -> Effly z x
forall (b :: * -> *) (m :: * -> *) α. MonadBase b m => b α -> m α
liftBase (m x -> Effly z x) -> m x -> Effly z x
forall a b. (a -> b) -> a -> b
$ e -> m x
forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
C.throwM e
x
CatchIO Effly z x
m e -> Effly z x
h -> Effly z (Effly z x) -> Effly z x
forall (m :: * -> *) a. Monad m => m (m a) -> m a
join (Effly z (Effly z x) -> Effly z x)
-> Effly z (Effly z x) -> Effly z x
forall a b. (a -> b) -> a -> b
$
(SomeException -> Effly z x)
-> Effly z (Effly z x) -> Effly z (Effly z x)
forall (s :: * -> *) (m :: * -> *) a.
Eff (Optional s) m =>
s a -> m a -> m a
optionally
(\SomeException
x -> case SomeException -> Maybe e
forall e. Exception e => SomeException -> Maybe e
X.fromException SomeException
x of
Just e
e -> e -> Effly z x
h e
e
Maybe e
Nothing -> m x -> Effly z x
forall (b :: * -> *) (m :: * -> *) α. MonadBase b m => b α -> m α
liftBase (m x -> Effly z x) -> m x -> Effly z x
forall a b. (a -> b) -> a -> b
$ SomeException -> m x
forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
C.throwM SomeException
x
)
((x -> Effly z x) -> Effly z x -> Effly z (Effly z x)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap x -> Effly z x
forall (f :: * -> *) a. Applicative f => a -> f a
pure Effly z x
m)
{-# INLINEABLE effHandler #-}
instance ( C.MonadCatch m
, Carrier m
)
=> PrimHandler ErrorIOFinalH (Optional ((->) SomeException)) m where
effPrimHandler :: Optional ((->) SomeException) m x -> m x
effPrimHandler = \case
Optionally SomeException -> x
h m x
m -> m x
m m x -> (SomeException -> m x) -> m x
forall (m :: * -> *) e a.
(MonadCatch m, Exception e) =>
m a -> (e -> m a) -> m a
`C.catch` (x -> m x
forall (m :: * -> *) a. Monad m => a -> m a
return (x -> m x) -> (SomeException -> x) -> SomeException -> m x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SomeException -> x
h)
{-# INLINEABLE effPrimHandler #-}