View source

class thx.Eithers

Available on all platforms

Extension methods for the thx.Either type.

Class Fields

static function flatMap<L, RIn, ROut>(either:Either<L, RIn>, f:RIn -> Either<L, ROut>):Either<L, ROut>

Maps an Either to and Either.

static function isLeft<L, R>(either:Either<L, R>):Bool

Indicates if the either has a Left value

static function isRight<L, R>(either:Either<L, R>):Bool

Indicates if the either has a Right value

static function leftMap<LIn, LOut, R>(either:Either<LIn, R>, f:LIn -> LOut):Either<LOut, R>

static function map<L, RIn, ROut>(either:Either<L, RIn>, f:RIn -> ROut):Either<L, ROut>

static function orThrow<L, R>(either:Either<L, R>, message:String):R

static function toLeft<L, R>(either:Either<L, R>):Option<L>

Converts the Either to an Option containing the Left value if Left, or None if Right.

static function toLeftUnsafe<L, R>(either:Either<L, R>):Null<L>

Extracts the left value if Left, or null if Right.

static function toRight<L, R>(either:Either<L, R>):Option<R>

Converts the Either to an Option containing the Right value if Right, or None if Left.

static function toRightUnsafe<L, R>(either:Either<L, R>):Null<R>

Extracts the right value if Right, or null if Left.

Toggle inherited fields