Either: Either monad implementation.

EitherR Documentation

Either monad implementation.

Description

Either monad implementation.

Either monad implementation.

Super classes

rhaskell::Functor -> rhaskell::Applicative -> rhaskell::Monad -> Either

Methods

Public methods

Inherited methods

Method new()

Usage
Either$new(mValue = NULL, isRight = TRUE)
Arguments
mValue

value.

Bind function


Method fmap()

Usage
Either$fmap(fun)

Method pure()

Usage
Either$pure(x)

Method apply()

Usage
Either$apply(x)

Method bind()

Usage
Either$bind(fun)
Arguments
fun

function to apply if it is a Right value

bind :: (b -> c) -> Either a b (=self) -> Either a c Unwrap a Left value with default.


Method fromLeft()

Usage
Either$fromLeft(def)
Arguments
def

default value

fromLeft :: a -> Either a b (=self) -> a Unwrap a Right value with default.


Method fromRight()

Usage
Either$fromRight(def)
Arguments
def

default value

fromRight :: b -> Either a b (=self) -> b Unwrap an Either from Left or Right with corresponding specified functions.


Method either()

Usage
Either$either(f, g)
Arguments
f

function to apply in case of Left value

g

function to apply in case of Right value

either :: (a -> c) -> (b -> c) -> Either a b (=self) -> c Unwrap Right value or call stop() on Left value.

fromRightOrStop :: Either Character b (=self) -> b Check if a Either is of type Right.

isRight :: Either a b (=self) -> Bool Check if a Either is of type Left.

isLeft :: Either a b (=self) -> Bool


Method fromRightOrStop()

Usage
Either$fromRightOrStop()

Method clone()

The objects of this class are cloneable with this method.

Usage
Either$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


schnecki/rhaskell documentation built on Oct. 30, 2022, 10:23 a.m.