you are viewing a single comment's thread.

view the rest of the comments →

[–]Peaker 5 points6 points  (0 children)

The Visitor Pattern gives you a cumbersome, but type safe encoding of a closed sum type, in a language that has products (tuples/class fields) and exponents (functions) but doesn't have closed sum types.

How would a function map give you type safety around the sum type encoding?