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

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

Overview

Value constructors

Instance Method Summary collapse

Instance Method Details

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

Failure constructor

Overloads:



347
348
349
350
# File 'lib/dry/monads/result.rb', line 347

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:



332
333
334
335
# File 'lib/dry/monads/result.rb', line 332

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