Wonderland v0.1.0 Wonderland.Data.Either View Source
Classic sum type which represents 2 alternatives
- Bifunctor
- Functor (as right)
- Monad (as right)
- Applicative (as right)
Link to this section Summary
Functions
- Accepts any term
- Returns
true
if term is value ofWonderland.Data.Either
λ-type, otherwise returnsfalse
If argument is left(x)
then returns true
If argument is right(x)
then returns false
Otherwise raise exception
If argument is right(x)
then returns true
If argument is left(x)
then returns false
Otherwise raise exception
First constructor
Second constructor
Link to this section Types
Link to this section Functions
- Accepts any term
- Returns
true
if term is value ofWonderland.Data.Either
λ-type, otherwise returnsfalse
If argument is left(x)
then returns true
If argument is right(x)
then returns false
Otherwise raise exception
Examples
iex> x = Either.left(1)
iex> y = Either.right(1)
iex> Either.is_left?(x)
true
iex> Either.is_left?(y)
false
If argument is right(x)
then returns true
If argument is left(x)
then returns false
Otherwise raise exception
Examples
iex> x = Either.left(1)
iex> y = Either.right(1)
iex> Either.is_right?(x)
false
iex> Either.is_right?(y)
true
First constructor
Examples
iex> x = Either.left(1)
iex> Either.is_left?(x)
true
Second constructor
Examples
iex> x = Either.right(1)
iex> Either.is_right?(x)
true