Class: Arrows::Proc
- Inherits:
-
Proc
- Object
- Proc
- Arrows::Proc
- Defined in:
- lib/arrows/proc.rb
Instance Method Summary collapse
-
#%(f) ⇒ Object
concurrent composition.
-
#/(f) ⇒ Object
fanout composition.
-
#>=(f) ⇒ Object
applicative fmap.
-
#>>(f) ⇒ Object
standard composition.
-
#^(f) ⇒ Object
fork composition.
-
#memoize ⇒ Object
Returns a memoizing version of this proc.
Instance Method Details
#%(f) ⇒ Object
concurrent composition
18 19 20 |
# File 'lib/arrows/proc.rb', line 18 def %(f) Arrows.concurrent self, Arrows.lift(f) end |
#/(f) ⇒ Object
fanout composition
13 14 15 |
# File 'lib/arrows/proc.rb', line 13 def /(f) Arrows.fanout self, Arrows.lift(f) end |
#>=(f) ⇒ Object
applicative fmap
3 4 5 |
# File 'lib/arrows/proc.rb', line 3 def >=(f) Arrows.fmap self, Arrows.lift(f) end |
#>>(f) ⇒ Object
standard composition
8 9 10 |
# File 'lib/arrows/proc.rb', line 8 def >>(f) Arrows.compose self, Arrows.lift(f) end |
#^(f) ⇒ Object
fork composition
23 24 25 |
# File 'lib/arrows/proc.rb', line 23 def ^(f) Arrows.fork self, f end |
#memoize ⇒ Object
Returns a memoizing version of this proc
28 29 30 31 |
# File 'lib/arrows/proc.rb', line 28 def memoize cache = {} Arrows.lift -> (args) { cache.has_key?(args) ? cache[args] : (cache[args] = self[args]) } end |