Class: Monadt::Async
- Inherits:
-
Object
- Object
- Monadt::Async
- Defined in:
- lib/monadt/async.rb
Class Method Summary collapse
Class Method Details
.bind(m, &blk) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/monadt/async.rb', line 7 def bind(m, &blk) a = m.resume m2 = blk.call(a) if m2.alive? m2 else self.return a end end |
.return(a) ⇒ Object
17 18 19 |
# File 'lib/monadt/async.rb', line 17 def return(a) Fiber.new { a } end |