Class: Kleisli::Either::Left
- Inherits:
-
Kleisli::Either
- Object
- Functor
- Monad
- Kleisli::Either
- Kleisli::Either::Left
- Defined in:
- lib/kleisli/either.rb
Instance Attribute Summary
Attributes inherited from Kleisli::Either
Instance Method Summary collapse
- #>(f) ⇒ Object
- #fmap(&f) ⇒ Object
-
#initialize(left) ⇒ Left
constructor
A new instance of Left.
- #or(other, &other_blk) ⇒ Object
- #to_maybe ⇒ Object
Methods inherited from Kleisli::Either
Methods inherited from Monad
Constructor Details
#initialize(left) ⇒ Left
Returns a new instance of Left.
47 48 49 |
# File 'lib/kleisli/either.rb', line 47 def initialize(left) @left = left end |
Instance Method Details
#>(f) ⇒ Object
51 52 53 |
# File 'lib/kleisli/either.rb', line 51 def >(f) self end |
#fmap(&f) ⇒ Object
55 56 57 |
# File 'lib/kleisli/either.rb', line 55 def fmap(&f) self end |
#or(other, &other_blk) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/kleisli/either.rb', line 63 def or(other, &other_blk) if other_blk other_blk.call(@left) else other end end |