class Arrows::Proc

Public Instance Methods

%(f) click to toggle source

concurrent composition

# File lib/arrows/proc.rb, line 18
def %(f)
  Arrows.concurrent self, Arrows.lift(f)
end
/(f) click to toggle source

fanout composition

# File lib/arrows/proc.rb, line 13
def /(f)
  Arrows.fanout self, Arrows.lift(f)
end
<=>(g) click to toggle source

feedback (aka ArrowLoop) composition

# File lib/arrows/proc.rb, line 28
def <=>(g) 
  Arrows.feedback self, g
end
>=(f) click to toggle source

applicative fmap

# File lib/arrows/proc.rb, line 3
def >=(f)
  Arrows.fmap self, Arrows.lift(f)
end
>>(f) click to toggle source

standard composition

# File lib/arrows/proc.rb, line 8
def >>(f)
  Arrows.compose self, Arrows.lift(f)
end
^(f) click to toggle source

fork composition

# File lib/arrows/proc.rb, line 23
def ^(f)
  Arrows.fork self, f
end
memoize() click to toggle source

Returns a memoizing version of this proc

# File lib/arrows/proc.rb, line 33
def memoize
  cache = {}
  Arrows.lift -> (args) { cache.has_key?(args) ? cache[args] : (cache[args] = self[args]) }
end
rescue_from(error_klass=StandardError) { |e, args| ... } click to toggle source

rescues errors from procs

# File lib/arrows/proc.rb, line 39
def rescue_from(error_klass=StandardError)
  Arrows.lift -> (args) {
    begin
      self[args]
    rescue error_klass => e
      yield e, args
    end
  }
end