class Unsound::Data::Right
Public Instance Methods
>>(f = nil, &blk)
click to toggle source
Chain another operation which can result in a {Data::Either}
@param f the next operation @return [Data::Left, Data::Right]
# File lib/unsound/data/either.rb, line 80 def >>(f = nil, &blk) (f || blk)[value] end
Also aliased as: and_then
either(_, f)
click to toggle source
Call a function on the value in the {Data::Right}
@param _ [#call] a function that will never be called @param f [#call] a function capable of processing the value
# File lib/unsound/data/either.rb, line 96 def either(_, f) f[value] end
fmap(f = nil, &blk)
click to toggle source
Apply a function to a value contained in a {Data::Right}
@param f [#call] the function to apply @return [Data::Right] the result of applying the function
wrapped in a {Data::Right}
# File lib/unsound/data/either.rb, line 72 def fmap(f = nil, &blk) self >> Composition.compose(method(:of), (f || blk)) end
or_else(*)
click to toggle source
A Noop
@return [Data::Right]
# File lib/unsound/data/either.rb, line 88 def or_else(*) self end