pyeffects
pyeffects copied to clipboard
Combinators for `Either` <--> `Option`
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 , 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/