-- |Combinators for 'Stop'. -- Internal. module Helic.Stop where -- |Catch all exceptions in an 'IO' action, embed it into a 'Sem' and convert exceptions to 'Stop'. tryStop :: Members [Stop Text, Embed IO] r => IO a -> Sem r a tryStop :: forall (r :: EffectRow) a. Members '[Stop Text, Embed IO] r => IO a -> Sem r a tryStop = forall err (r :: EffectRow) a. Member (Stop err) r => Either err a -> Sem r a stopEither forall (m :: * -> *) b c a. Monad m => (b -> m c) -> (a -> m b) -> a -> m c <=< forall (r :: EffectRow) a. Member (Embed IO) r => IO a -> Sem r (Either Text a) tryAny