Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/do_notation/monads/array.rb
Class Method Summary collapse
Methods included from Monad
Methods included from MonadPlus
Class Method Details
.bind(value, &f) ⇒ Object
11 12 13 |
# File 'lib/do_notation/monads/array.rb', line 11 def self.bind value, &f value.map(&f).inject([], &:+) end |
.mplus(a, b) ⇒ Object
21 22 23 |
# File 'lib/do_notation/monads/array.rb', line 21 def self.mplus(a, b) a + b end |
.mzero ⇒ Object
17 18 19 |
# File 'lib/do_notation/monads/array.rb', line 17 def self.mzero [] end |
.unit(x) ⇒ Object
7 8 9 |
# File 'lib/do_notation/monads/array.rb', line 7 def self.unit x [x] end |