Either | R Documentation |
Either monad implementation.
Either monad implementation.
rhaskell::Functor
-> rhaskell::Applicative
-> rhaskell::Monad
-> Either
new()
Either$new(mValue = NULL, isRight = TRUE)
mValue
value.
Bind function
fmap()
Either$fmap(fun)
pure()
Either$pure(x)
apply()
Either$apply(x)
bind()
Either$bind(fun)
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.
fromLeft()
Either$fromLeft(def)
def
default value
fromLeft :: a -> Either a b (=self) -> a
Unwrap a Right value with default.
fromRight()
Either$fromRight(def)
def
default value
fromRight :: b -> Either a b (=self) -> b
Unwrap an Either from Left or Right with corresponding specified functions.
either()
Either$either(f, g)
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
fromRightOrStop()
Either$fromRightOrStop()
clone()
The objects of this class are cloneable with this method.
Either$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.