Result is a wrapper type (abstract) around the Either type to semantically represent the state of an operation.

Variables

read onlyisFailure:Bool

It is true if Result wraps an error.

read onlyisSuccess:Bool

It is true if Result wraps a value.

Methods

error ():Null<TFailure>

Converts Result into a nullable value of type TFailure.

optionError ():Option<TFailure>

Converts Result<TSuccess, TFailure> into Option<TFailure>. The result is Some(error) if Result contained an error. It is None if it contains a value.

optionValue ():Option<TSuccess>

Converts Result<TSuccess, TFailure> into Option<TSuccess>. The result is Some(value) if Result contained a value. It is None if it contains an error.

value ():Null<TSuccess>

Converts Result into a nullable value of type TSuccess.

Static methods

staticinline failure<TSuccess, TFailure> (error:TFailure):Result<TSuccess, TFailure>

staticinline success<TSuccess, TFailure> (value:TSuccess):Result<TSuccess, TFailure>