typelift / Swiftx

Functional data types and functions for any project
BSD 3-Clause "New" or "Revised" License
219 stars 28 forks source link

Add left and right optional properties to Either. #46

Closed mpurland closed 8 years ago

CodaFi commented 8 years ago

This is good to merge, but before I do is there another name you'd like to give to these partial projection functions? Even Haskell doesn't have great names for these things.

mpurland commented 8 years ago

I like the name since left and right is short to reference, what do you think?

mpurland commented 8 years ago

Scala's Either type has left but it returns a LeftProjection. Perhaps we could do the same but have a LeftProjection that is a Generator to use in a "for in".

CodaFi commented 8 years ago

Scala's For-comprehensions are miles ahead of anything I think swift has to offer. If you're cool with this, I am too.

:boat: