View source

abstract thx.Result<TSuccess, TFailure>(Either<TFailure, TSuccess>) from Either<TFailure, TSuccess> to Either<TFailure, TSuccess>

Available on all platforms

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

Instance Fields

var isFailure(get,null):Bool

It is true if Result wraps an error.

var isSuccess(get,null):Bool

It is true if Result wraps a value.

function error():Null<TFailure>

Converts Result into a nullable value of type TFailure.

function 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.

function 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.

function value():Null<TSuccess>

Converts Result into a nullable value of type TSuccess.