Class: Unsound::Data::Nothing
Instance Method Summary collapse
-
#>> ⇒ Data::Nothing
(also: #and_then)
A Noop.
-
#fmap ⇒ Data::Nothing
A Noop.
-
#maybe(_, f) ⇒ Object
Call the specified function with no arguments.
-
#or_else(f = nil, &blk) ⇒ Data::Nothing, Data::Just
Chain another operation which can result in a Maybe.
Methods inherited from Maybe
Instance Method Details
#>> ⇒ Data::Nothing Also known as: and_then
A Noop
45 46 47 |
# File 'lib/unsound/data/maybe.rb', line 45 def >>(*) self end |
#fmap ⇒ Data::Nothing
A Noop
38 39 40 |
# File 'lib/unsound/data/maybe.rb', line 38 def fmap(*) self end |
#maybe(_, f) ⇒ Object
Call the specified function with no arguments
62 63 64 |
# File 'lib/unsound/data/maybe.rb', line 62 def maybe(_, f) f[] end |
#or_else(f = nil, &blk) ⇒ Data::Nothing, Data::Just
Chain another operation which can result in a Maybe
54 55 56 |
# File 'lib/unsound/data/maybe.rb', line 54 def or_else(f = nil, &blk) (f || blk).call end |