Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LeftProjection<A, B>

Type parameters

  • A

  • B

Hierarchy

Implements

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

Properties

Private e

e: Either<A, B>

Accessors

@@__TSFP_RECORD__@@

  • get @@__TSFP_RECORD__@@(): boolean

get

  • get get(): A
  • Returns the value from this Either if this is of a Left, otherwise throws an Error.

    Returns A

toMaybe

  • get toMaybe(): Maybe<A>
  • Returns a Just containing the Either value if this is of a Left or a Nothing if this is of a Right.

    {{{ Left(12).left.toMaybe // Just(12) Right(12).left.toMaybe // Nothing }}}

    Returns Maybe<A>

Methods

equals

  • equals(that: any): boolean

flatMap

  • flatMap<X>(fn: function): Either<X, B>
  • Binds the given function across Left if this is of a Left, otherwise returns the original Either. Slightly different from map is that fn is expected to return an Either.

    Type parameters

    • X

    Parameters

    • fn: function

      The function to bind accross the Left

    Returns Either<X, B>

getOrElse

  • getOrElse<X>(or: X): A | X
  • Returns the value from this Either if this is of a Left, or the given argument if this is of a Right.

    Type parameters

    • X

    Parameters

    • or: X

      The default value

    Returns A | X

map

  • map<X>(fn: function): Either<X, B>
  • Maps the function argument through Left if this is of a Left, otherwise returns the original Eihter.

    Type parameters

    • X

    Parameters

    • fn: function

      The function to map

        • (a: A): X
        • Parameters

          • a: A

          Returns X

    Returns Either<X, B>

toString

  • toString(): string

Generated using TypeDoc