struct Monads::Right(T)
Defined in:
monads/either.crConstructors
Instance Method Summary
-
#<=>(other : Right)
The comparison operator.
-
#<=>(other : Either)
The comparison operator.
-
#<=>(other : Leftable)
The comparison operator.
- #bind(lambda : T -> Either(_, _))
- #fmap(lambda : T -> U) : Right(U) forall U
- #map_or(default : U, lambda : T -> U) forall U
- #map_or(default : U, &block : T -> U) forall U
- #or(monad : Either)
- #or(lambda : _ -> _) : Right(T)
- #value_or(element : _)
Instance methods inherited from struct Monads::Either(Nil, T)
<=>(other : Right)<=>(other : Left) <=>, inspect(io) inspect, left? left?, map_or(default : U, lambda : T -> U) forall U map_or, or(monad : Either)
or(lambda : E -> U) forall U
or(&block : E -> U) forall U or, right? right?, to_s to_s, value! : E | T value!, value_or(element : U) forall U
value_or(lambda : E -> U) forall U
value_or(&block : E -> U) forall U value_or
Constructor methods inherited from struct Monads::Either(Nil, T)
new
new
Class methods inherited from struct Monads::Either(Nil, T)
return(value : T) : Right(T)
return
Instance methods inherited from struct Monads::Monad(T)
>>(other : Monad(U)) forall U
>>,
|(other : _ -> Monad(U)) forall U
|,
bind(lambda : T -> Monad(U)) forall Ubind(&block : T -> Monad(U)) forall U bind
Constructor methods inherited from struct Monads::Monad(T)
new
new,
return(v : T) : self
return
Instance methods inherited from struct Monads::Functor(T)
fmap(lambda : T -> U)fmap(&block : T -> U) forall U fmap, initialize initialize
Constructor methods inherited from struct Monads::Functor(T)
new
new
Constructor Detail
Instance Method Detail
The comparison operator. Returns 0
if the two objects are equal,
a negative number if this object is considered less than other,
a positive number if this object is considered greater than other,
or nil
if the two objects are not comparable.
Subclasses define this method to provide class-specific ordering.
The comparison operator is usually used to sort values:
# Sort in a descending way:
[3, 1, 2].sort { |x, y| y <=> x } # => [3, 2, 1]
# Sort in an ascending way:
[3, 1, 2].sort { |x, y| x <=> y } # => [1, 2, 3]
The comparison operator. Returns 0
if the two objects are equal,
a negative number if this object is considered less than other,
a positive number if this object is considered greater than other,
or nil
if the two objects are not comparable.
Subclasses define this method to provide class-specific ordering.
The comparison operator is usually used to sort values:
# Sort in a descending way:
[3, 1, 2].sort { |x, y| y <=> x } # => [3, 2, 1]
# Sort in an ascending way:
[3, 1, 2].sort { |x, y| x <=> y } # => [1, 2, 3]
The comparison operator. Returns 0
if the two objects are equal,
a negative number if this object is considered less than other,
a positive number if this object is considered greater than other,
or nil
if the two objects are not comparable.
Subclasses define this method to provide class-specific ordering.
The comparison operator is usually used to sort values:
# Sort in a descending way:
[3, 1, 2].sort { |x, y| y <=> x } # => [3, 2, 1]
# Sort in an ascending way:
[3, 1, 2].sort { |x, y| x <=> y } # => [1, 2, 3]