Module: Dry::Monads::Result::Mixin::Constructors

Included in:
Dry::Monads, Dry::Monads::Result::Mixin
Defined in:
lib/dry/monads/result.rb,
lib/dry/monads/either.rb

Overview

Value constructors

Constant Summary collapse

Right =
Success
Left =
Failure

Instance Method Summary collapse

Instance Method Details

#Success(value) ⇒ Result::Failure #Success(&block) ⇒ Result::Failure

Failure constructor

Overloads:


266
267
268
269
# File 'lib/dry/monads/result.rb', line 266

def Failure(value = Undefined, &block)
  v = Undefined.default(value, block || Unit)
  Failure.new(v, RightBiased::Left.trace_caller)
end

#Success(value) ⇒ Result::Success #Success(&block) ⇒ Result::Success

Success constructor

Overloads:


251
252
253
254
# File 'lib/dry/monads/result.rb', line 251

def Success(value = Undefined, &block)
  v = Undefined.default(value, block || Unit)
  Success.new(v)
end