arrow-core-data / arrow.typeclasses / MonadThrow


interface MonadThrow<F> : MonadError<F, Throwable>

MonadThrow has the error type fixed to Throwable. It provides fx.monadThrow for automatically catching throwable errors in the context of a binding, short-circuiting the complete computation and returning the error raised to the same computational context (through raiseError).


Oftentimes we find ourselves in situations where we need to sequence some computations that could potentially fail. fx.monadThrow allows us to safely compute those by automatically catching any exceptions thrown during the process.


fx Entry point for monad bindings which enables for comprehensions. The underlying implementation is based on coroutines. A coroutine is initiated and suspended inside MonadThrowContinuation yielding to Monad.flatMap. Once all the flatMap binds are completed, the underlying monad is returned from the act of executing the val fx: MonadThrowFx<F>


raiseNonFatal open fun <A> Throwable.raiseNonFatal(): Kind<F, A>


MonadThrowContinuation open class MonadThrowContinuation<F, A> : MonadContinuation<F, A>, MonadThrow<F>, MonadThrowSyntax<F>
MonadThrowSyntax interface MonadThrowSyntax<F> : MonadSyntax<F>, MonadThrow<F>

Type Class Hierarchy

Do you like Arrow?

Arrow Org