Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RightProjection<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(): B
  • Returns the value from this Either if this is of a Right, otherwise throws an Error.

    Returns B

toMaybe

  • Returns a Just containing the Either value if this is of a Right or a Nothing if this is a Left.

    {{{ Right(21).right.toMaybe // Just(21) Left(21).right.toMaybe // Nothing }}}

    Returns NothingWrapper

Methods

equals

  • equals(that: any): boolean

flatMap

  • flatMap<X>(fn: function): Either<A, X>
  • Binds the given function across Right if this is of a Right, 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 Right

    Returns Either<A, X>

getOrElse

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

    Type parameters

    • X

    Parameters

    • or: X

      The default value

    Returns B | X

map

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

    Type parameters

    • X

    Parameters

    • fn: function

      The function to map

        • (b: B): X
        • Parameters

          • b: B

          Returns X

    Returns Either<A, X>

toString

  • toString(): string

Generated using TypeDoc