class Deterministic::Either

Attributes

left[R]
right[R]

Public Class Methods

new(left=[], right=[]) click to toggle source
# File lib/deterministic/either.rb, line 8
def initialize(left=[], right=[])
  @left, @right = left, right
end

Public Instance Methods

+(other) click to toggle source
# File lib/deterministic/either.rb, line 14
def +(other)
  raise Deterministic::Monad::NotMonadError, "Expected an Either, got #{other.class}" unless other.is_a? Either

  Either.new(left + other.left, right + other.right)
end
inspect() click to toggle source
# File lib/deterministic/either.rb, line 22
def inspect
  "Either(left: #{left.inspect}, right: #{right.inspect})"
end