class Unparser::Either::Right
Public Instance Methods
bind() { |value| ... }
click to toggle source
Evaluate applicative block
@return [Either<Object>]
# File lib/unparser/either.rb, line 114 def bind yield(value) end
either(_left, right)
click to toggle source
Evaluate right side of branch
@param [#call] _left @param [#call] right
# File lib/unparser/either.rb, line 148 def either(_left, right) right.call(value) end
fmap() { |value| ... }
click to toggle source
Evaluate functor block
@return [Either::Right<Object>]
# File lib/unparser/either.rb, line 107 def fmap Right.new(yield(value)) end
from_left() { |value| ... }
click to toggle source
Unwrap value from left
@return [Object]
# File lib/unparser/either.rb, line 122 def from_left if block_given? yield(value) else fail "Expected left value, got #{inspect}" end end
from_right()
click to toggle source
Unwrap value from right
@return [Object]
# File lib/unparser/either.rb, line 133 def from_right value end
lmap(&block)
click to toggle source
Map over left value
@return [Either::Right<Object>]
# File lib/unparser/either.rb, line 140 def lmap(&block) require_block(&block) end