Re: The names "left" and "right"
Marc Nieper-WiÃkirchen 05 Jun 2020 15:39 UTC
Am Fr., 5. Juni 2020 um 17:28 Uhr schrieb Lassi Kortela <xxxxxx@lassi.io>:
> Would it be possible to use more obvious names for the Left and Right
> subtypes of Either? I know Left and Right are somewhat classic, but they
> are also somewhat arbitrary and confusing.
Not at all!
Either can be used either (no pun intended) to model an Ok/Err type or
to model a type with two symmetric alternatives.
For the first application, we use "Right" in the sense of right = true
= correct = ok. In this case, Ok/Err would also be ok (another pun not
intended).
For the second application, Left/Right is perfect because of its
symmetry. Ok/Err wouldn't make sense at all.
Marc