class Dry::Logic::Result

def and(other)

def and(other)
  if success?
    other.(input)
  else
    self
  end
end

def call(*)

def call(*)
  self
end

def curry(predicate_id = nil)

def curry(predicate_id = nil)
  if predicate_id
    Result::Verified.new(self, predicate_id)
  else
    self
  end
end

def failure?

def failure?
  ! success?
end

def initialize(input, value, rule)

def initialize(input, value, rule)
  @input = input
  @value = value
  @rule = rule
  @name = rule.name
end

def negated

def negated
  self.class.new(input, !value, rule)
end

def or(other)

def or(other)
  if success?
    self
  else
    other.(input)
  end
end

def success?

def success?
  @value
end

def then(other)

def then(other)
  if success?
    other.(input)
  else
    Logic.Result(input, true, rule)
  end
end

def wrapped?

def wrapped?
  false
end

def xor(other)

def xor(other)
  other_result = other.(input)
  value = success? ^ other_result.success?
  if other_result.wrapped?
    Result::Wrapped.new(input, value, rule)
  else
    Logic.Result(other_result.input, value, rule)
  end
end