Class: Kleisli::Either
Defined Under Namespace
Instance Attribute Summary collapse
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
Instance Method Summary collapse
Methods inherited from Monad
Methods inherited from Functor
Instance Attribute Details
#left ⇒ Object (readonly)
Returns the value of attribute left.
6 7 8 |
# File 'lib/kleisli/either.rb', line 6 def left @left end |
#right ⇒ Object (readonly)
Returns the value of attribute right.
6 7 8 |
# File 'lib/kleisli/either.rb', line 6 def right @right end |
Instance Method Details
#*(other) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/kleisli/either.rb', line 12 def *(other) self >-> f { other >-> val { Right(f.arity > 1 ? f.curry.call(val) : f.call(val)) } } end |
#==(other) ⇒ Object
8 9 10 |
# File 'lib/kleisli/either.rb', line 8 def ==(other) right == other.right && left == other.left end |