Class: Kleisli::Either::Right
- Inherits:
-
Kleisli::Either
- Object
- Functor
- Monad
- Kleisli::Either
- Kleisli::Either::Right
- Defined in:
- lib/kleisli/either.rb
Instance Attribute Summary
Attributes inherited from Kleisli::Either
Instance Method Summary collapse
- #>(f) ⇒ Object
- #fmap(&f) ⇒ Object
-
#initialize(right) ⇒ Right
constructor
A new instance of Right.
- #or(other, &other_blk) ⇒ Object
- #to_maybe ⇒ Object
Methods inherited from Kleisli::Either
Methods inherited from Monad
Constructor Details
#initialize(right) ⇒ Right
Returns a new instance of Right.
23 24 25 |
# File 'lib/kleisli/either.rb', line 23 def initialize(right) @right = right end |
Instance Method Details
#>(f) ⇒ Object
27 28 29 |
# File 'lib/kleisli/either.rb', line 27 def >(f) f.call(@right) end |
#fmap(&f) ⇒ Object
31 32 33 |
# File 'lib/kleisli/either.rb', line 31 def fmap(&f) Right.new(f.call(@right)) end |
#or(other, &other_blk) ⇒ Object
39 40 41 |
# File 'lib/kleisli/either.rb', line 39 def or(other, &other_blk) self end |