pyeffects icon indicating copy to clipboard operation
pyeffects copied to clipboard

Combinators for `Either` <--> `Option`

Open vreuter opened this issue 1 year ago • 1 comments
trafficstars

Hi @vickumar1981 thanks for this excellent project. Would you be open to addition of combinators on Either and Option to flip back-and-forth, analogous to toLeft and toRight on scala.Option and toOption on scala.Either?

vreuter avatar Jul 17 '24 15:07 vreuter

@vreuter , i think that would be a great feature/functionality to add.

So basically, to the Either subclasses, we can add toOption().

And to the Option subclasses, we can add toRight (not sure how to deal with toLeft but open to ideas).

For anyone's reference: https://scalajobs.com/blog/how-to-convert-option-to-either-in-scala/

vickumar1981 avatar Jul 18 '24 15:07 vickumar1981