Class: Monadt::PresentM
- Inherits:
-
Object
- Object
- Monadt::PresentM
- Defined in:
- lib/monadt/maybe.rb
Overview
like Maybe but nil / not-nill
Class Method Summary collapse
Class Method Details
.bind(m, &blk) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/monadt/maybe.rb', line 37 def bind(m, &blk) if m.nil? nil else blk.call(m) end end |
.return(a) ⇒ Object
45 46 47 |
# File 'lib/monadt/maybe.rb', line 45 def return(a) a end |