module Rammed::Monad::Base

Public Instance Methods

<(other) click to toggle source
# File lib/monad/base.rb, line 13
def <(other)
  ap(other)
end
>(other) click to toggle source
# File lib/monad/base.rb, line 17
def >(other)
  other.ap(self)
end
>>(f) click to toggle source
# File lib/monad/base.rb, line 9
def >>(f)
  bind(f)
end
ap(other) click to toggle source
# File lib/monad/base.rb, line 21
def ap(other)
  self >> (lambda do |f|
    other >> (lambda do |x|
      mreturn f.(x)
    end)
  end)
end
map(f) click to toggle source
# File lib/monad/base.rb, line 29
def map(f)
  self >> ->(x) { mreturn f.(x) }
end