Tag: sumtypes

Everything you wanted to know about Sum Types (but were almost afraid to ask)

Everything you wanted to know about Sum Types (but were almost afraid to ask)

A lot of messy JavaScript has to do with loose typing, invalid values and the horrible chain of ternary expressions or — heaven forbid — if statements to handle them. With JavaScript, all functions run on the concept of “pretend what you are getting is what you asked for”. If the value is not valid for the kind of…