rauschma / exploring-reasonml

http://reasonmlhub.com/exploring-reasonml/
26 stars 0 forks source link

Chapter: Polymorphic variant types #12

Open rauschma opened 6 years ago

geohuz commented 5 years ago

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!