vickumar1981 / pyeffects

Handle side-effects in Python like a boss. Implements functional types for Either, Option, Try, and Future.
Other
30 stars 6 forks source link

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

Open vreuter opened 1 month ago

vreuter commented 1 month ago

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?

vickumar1981 commented 1 month ago

@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/