Module: Monad
- Included in:
- Array, Distribution, Expectation, Identity, Maybe, Simulation
- Defined in:
- lib/do_notation/monad.rb
Instance Method Summary collapse
Instance Method Details
#bind_const(value, &block) ⇒ Object
6 7 8 |
# File 'lib/do_notation/monad.rb', line 6 def bind_const value, &block bind(value) { block.call } end |
#compose(a, b) ⇒ Object
10 11 12 |
# File 'lib/do_notation/monad.rb', line 10 def compose a, b bind_const(a) { b } end |
#run(&block) ⇒ Object
2 3 4 |
# File 'lib/do_notation/monad.rb', line 2 def run &block DoNotation.run(self, &block) end |