Skip to contents

Creates a Maybe monad instance which can be used with the flatMap operator %>>=%. See the Monads in R vignette for more details.

This container, when flatMapped, always returns a value, either of type Nothing (if an error was raised or the result was NULL), or Just.

Public fields

value

value contained in the instance

Methods


Method new()

create a new Maybe instance

Usage

Maybe$new(value)

Arguments

value

value to be contained

Returns

a new Maybe instance


Method bind()

bind when using flatMap (%>>=%)

Usage

Maybe$bind(f, expr)

Arguments

f

function to apply

expr

expression of the function


Method clone()

The objects of this class are cloneable with this method.

Usage

Maybe$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.