class Obfusk::Monads::Maybe

Public Class Methods

bind_pass(m, &b) click to toggle source
# File lib/obfusk/monads.rb, line 42
def self.bind_pass(m, &b)
  m.match Nothing:  -> (_) { Nothing()  },
          Just:     -> (x) { b[x.value] }
end
lazy_plus(m, k) click to toggle source
# File lib/obfusk/monads.rb, line 49
def self.lazy_plus(m, k)
  m.match Nothing:  -> (_) { k._ },
          Just:     -> (_) { m   }
end
mreturn(x) click to toggle source
# File lib/obfusk/monads.rb, line 39
def self.mreturn(x)
  Just(x)
end
zero() click to toggle source
# File lib/obfusk/monads.rb, line 46
def self.zero
  Nothing()
end