Maybe: Maybe monad implementation.

MaybeR Documentation

Maybe monad implementation.

Description

Maybe monad implementation.

Maybe monad implementation.

Super classes

rhaskell::Functor -> rhaskell::Applicative -> rhaskell::Monad -> Maybe

Methods

Public methods

Inherited methods

Method new()

Usage
Maybe$new(mValue = NULL)
Arguments
mValue

value.

Return the value. Fails if the encapsulated value is NULL! Better use fromMaybe!

isJust :: Maybe a (=self) -> a Unwrap the value with a default.


Method fmap()

Usage
Maybe$fmap(fun)

Method pure()

Usage
Maybe$pure(x)

Method apply()

Usage
Maybe$apply(x)

Method empty()

Usage
Maybe$empty()

Method alt()

Usage
Maybe$alt(other)

Method bind()

Usage
Maybe$bind(fun)

Method fromJust()

Usage
Maybe$fromJust()

Method fromMaybe()

Usage
Maybe$fromMaybe(def)
Arguments
def

default value

fromMaybe :: a -> Maybe a (=self) -> a Unwrap a maybe with default value and a function to apply.


Method maybe()

Usage
Maybe$maybe(def, f)
Arguments
def

default value

f

function to apply in case of Just() value

maybe :: a -> (a -> b) -> Maybe a (=self) -> a Check if a Maybe is of type Just.

isJust :: Maybe a (=self) -> Bool Check if a Maybe is of type Nothing.

isJust :: Maybe a (=self) -> Bool


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.


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