flix

0.77.0

OutOfBounds

eff OutOfBoundsSource

Effect for signaling that an index is out of bounds.

Useful for instances of Index or IndexMut.

Effect for signaling that an index is out of bounds, and its functions.

Operations

def outOfBounds(msg: String): Void \ OutOfBounds§ Source

Stops execution with an error message.

Definitions

@Experimental
def handleWithResult(f: a -> b \ ef): a -> Result[String, b] \ ef - OutOfBounds§ Source

Handles the OutOfBounds effect of the given function f by converting out-of-bounds errors to Result values.

Returns Ok(f(x)) if the computation completes successfully. Returns Err(msg) if the computation raises outOfBounds(msg).

@Experimental
def runWithResult(f: Unit -> a \ ef): Result[String, a] \ ef - OutOfBounds§ Source

Runs the OutOfBounds effect of the given function f.

Returns Ok(f()) if the computation completes successfully. Returns Err(msg) if the computation raises outOfBounds(msg).