Class: Monadt::Either
Constant Summary collapse
- Left =
data :left
- Right =
data :right
Class Method Summary collapse
Methods included from Adt
Class Method Details
.bind(m, &blk) ⇒ Object
11 12 13 14 15 |
# File 'lib/monadt/either.rb', line 11 def bind(m, &blk) match(m, with(Left) { |v| m }, with(Right) { |v| blk.call(v) }) end |
.return(a) ⇒ Object
17 18 19 |
# File 'lib/monadt/either.rb', line 17 def return(a) right a end |