Algebraic data types for Javascript