nidula library

This is the base nidula library, containing both Option and Result types.

Classes

Err<T, E>
A type that represents an unsuccessful Result.
ErrPropagationToken<E>
Token that is given as callback parameter of Result.tryScope and Result.asyncTryScope, so that Result.try_ can be used safely.
None<T>
A type that represents the absence of a value.
NonePropagationToken
Token that is given as callback parameter of Option.tryScope and Option.asyncTryScope, so that Option.try_ can be used safely.
Ok<T, E>
A type that represents a successful Result.
Option<T>
A type that represents the presence (Some holding a data value of type T) or absence (None) of a value.
Result<T, E>
A type that represents either success (Ok holding a data value of type T) or failure (Err holding an error value of type E).
Some<T>
A type that represents the presence of a value of type T.

Extensions

FlattenOptionExtension on Option<Option<T>>
Provides the flatten method to Option type values that hold another Option.
FlattenResultExtension on Result<Result<T, E>, E>
Provides the flatten method to Result type values that hold another Result.
NonNullableEResultTExtension on Result<T, E>
Provides errToNullable to Result<T, E extends Object> types (i.e., non-nullable E types).
NonNullableOptionExtension on Option<T>
Provides toNullable to Option<T extends Object> types (i.e., options with non-nullable T types).
NonNullableTResultTExtension on Result<T, E>
Provides okToNullable to Result<T extends Object, E> types (i.e., non-nullable T types).
TransposeOptionExtension on Option<Result<T, E>>
Provides the transpose method to Option type values that hold a Result.
TransposeResultExtension on Result<Option<T>, E>
Provides the transpose() method to Result type values that hold an Option value.
UnzipOptionExtension on Option<(T, U)>
Provides the unzip method to Option type values that hold a Record of two values.

Functions

identity<T>(T v) → T
Identity function.
zipOp<T, U, W>(Option<T> a, W op(T a, U b), Option<U> b) Option<W>
Works like Option.zipWith, but it is a bit more operation friendly.

Exceptions / Errors

ErrPropagation<E>
Err's early return's first step (parallel of Rust's try operator) in a programming language with exceptions. If Result.try_ is used on an Err, an ErrPropagation will be thrown.
JsonException
Exception that is thrown if json['type'] is missing or wrong when using Option.fromJson or Result.fromJson.
NonePropagation
None's early return's first step (parallel of Rust's try operator) in a programming language with exceptions. If Option.try_ is used on a None, a NonePropagation will be thrown.
Panic
Represents an error that should not be handled. Panics are generally reserved for unrecoverable errors.
Propagation
Abstract class that is extended by all propagation types.