@@ -23,6 +23,7 @@ module Yoga.Om
2323 , launchOm_
2424 , note
2525 , noteM
26+ , orFail
2627 , parOmToAff
2728 , race
2829 , inParallel
@@ -91,6 +92,7 @@ import Heterogeneous.Folding (class FoldingWithIndex, class HFoldlWithIndex, hfo
9192import Heterogeneous.Mapping (class HMap, class Mapping, hmap)
9293import Record.Builder (Builder)
9394import Record.Builder as Builder
95+
9496-- | "dependency injection" via `ReaderT` which tracks a context, and
9597-- | checked exceptions and early return with `ExceptV`.
9698newtype Om ctx err a = Om
@@ -188,6 +190,9 @@ note err = maybe (throw err) pure
188190noteM ∷ ∀ err m a. MonadThrow err m ⇒ m err → Maybe a → m a
189191noteM err = maybe (throwError =<< err) pure
190192
193+orFail ∷ ∀ m a. Monad m ⇒ m a → Maybe a → m a
194+orFail err = maybe err pure
195+
191196-- | Turns a `Left a` into an exception which reduces nesting
192197throwLeftAs
193198 ∷ ∀ err m left right