Module: Ribimaybe::Maybe

Includes:
Contracts
Defined in:
lib/ribimaybe.rb

Defined Under Namespace

Modules: Nothing Classes: Just

Instance Method Summary collapse

Instance Method Details

#Maybe(value = nil, &fn) ⇒ Object Also known as: Just, pure, unit



180
181
182
# File 'lib/ribimaybe.rb', line 180

def Maybe(value = nil, &fn)
  (value || fn) ? Just.new(value || fn.curry) : Nothing
end