News for hackers. Stuff that matters.
Re:Elegant Error Handling with the JavaScript “Either” Monad by derefr on Tuesday June 25, 2019 @01:17PM (#20276495)
Or, to put that another way, Either is "cons" for types, and you can build up a sum type as a type-level linked list of types by repeatedly "cons"ing (Either-ing) types together: (a || b || c || ...). The functional-programming traditionalist would call the type-level "slots" of an Either its "CAR type" and "CDR type".

But, since there's no abstraction that assumes that such a structure of sum-types is shaped like a proper list, there's nothing stopping you from building any arbitrary binary tree of types using Either. And so, like any other binary tree, the two branches get called Left and Right.

There are no comments on this comment yet.