std/core/exn▲toc

Standard exception (exnstd/core/exn/exn: (E, V) -> V) effect.

.

type errorstd/core/exn/error: V -> V<a>

An errorstd/core/exn/error: V -> V type represents a first-class exception result.

con Ok(result : a)
fun default( t : errorstd/core/exn/error: V -> V<a>, def : a ) : a

Use default value def in case of an error.

Transform an exception effect to an errorstd/core/exn/error: V -> V type.

struct exceptionstd/core/exn/exception: V(message : stringstd/core/types/string: Vinfo : exception-infostd/core/exn/exception-info: V)

The exception data type.

Automatically generated. Retrieves the info constructor field of the exceptionstd/core/exn/exception: V type.

Automatically generated. Retrieves the message constructor field of the exceptionstd/core/exn/exception: V type.

Show the exception message.

type open exception-infostd/core/exn/exception-info: V

Exception information.

Generic error.

con ExnTodo
type exnstd/core/exn/exn: (E, V) -> V<e,a>

Exceptions

Operations:

final ctl throw-exn
final ctl throw-exnstd/core/exn/throw-exn: forall<a> (exn : exception) -> exn a
.

fun exn/try( action : () -> <exnstd/core/exn/exn: (E, V) -> V|e> a, hndl : (exceptionstd/core/exn/exception: V) -> e a ) : e a

Catch any exception raised in action and handle it. Use on-exn or on-exitstd/core/exn/on-exit: forall<a,e> (hndler : () -> e (), action : () -> e a) -> e a when appropriate.

fun catch( action : () -> <exnstd/core/exn/exn: (E, V) -> V|e> a, hndl : (exceptionstd/core/exn/exception: V) -> e a ) : e a

Deprecated; use try instead. Catch an exception raised by throwstd/core/exn/throw: forall<a> (message : string, info : ? exception-info) -> exn a and handle it. Use on-exn or on-exitstd/core/exn/on-exit: forall<a,e> (hndler : () -> e (), action : () -> e a) -> e a when appropriate.

fun error-pattern( location : stringstd/core/types/string: V, definition : stringstd/core/types/string: V ) : exnstd/core/exn/exn: (E, V) -> V a

Raise a pattern match exception. This is function is used internally by the compiler to generate error messages on pattern match failures.

fun exn-error-range(): exnstd/core/exn/exn: (E, V) -> V a
fun on-exit( hndler : () -> e (), action : () -> e a ) : e a

Set a hndler that is always called when the action finishes (either normally or with an exception).

fun throw( message : stringstd/core/types/string: V, info : ? exception-infostd/core/exn/exception-info: V ) : exnstd/core/exn/exn: (E, V) -> V a

Throw an exception with a specified message.

private import std/core/typesstd/core/types, std/core/hndstd/core/hnd