Abort
Effect for aborting a computation with an error message, and its functions.
Operations
def abort(m: RichString): Void \ Abort§ SourceImmediately aborts the current computation with the given error message m.
The computation cannot be resumed.
Definitions
Aborts the current computation with the given error message m enriched with a JVM stack trace.
Handles the Abort effect of the given function f by printing the error message and exiting.
In other words, re-interprets the Abort effect using the IO effect.
Note: The returned function can still return normally if abort is never called by f.
def handleWithResult(f: a -> b \ ef): a -> Result[RichString, b] \ ef - Abort§ SourceHandles the Abort effect of the given function f by converting aborts to Result values.
Returns a function that
Returns Ok(f()) if the computation completes successfully without aborting.
Returns Err(m) if the computation aborts with error message m.
@DefaultHandler Runs the Abort effect of the given function f.
In other words, re-interprets the Abort effect using the IO effect.
Note: This function can still return normally if abort is never called by f.
def runWithResult(f: Unit -> a \ ef): Result[RichString, a] \ ef - Abort§ SourceRuns the Abort effect of the given function f.
Returns Ok(f()) if the computation completes successfully without aborting.
Returns Err(m) if the computation aborts with error message m.