exploring-reasonml
exploring-reasonml copied to clipboard
Chapter: Polymorphic variant types
My 2 cents, it's better to mention(emphasis) we can extent shape in this way:
type shapePlus = [ | shape |
Triangle(point, point, point)
];
`
in addition to the #shape in switch, we get the power of extending a program without touching the original code! I can see this pattern as predicate dispatch(generalized multi-dispatch) and it's awesome!