The visitor pattern

Contents
  • Two kinds of type hierarchies
    • Open type hierarchies
    • Closed type hierarchies

First we will discuss “visitor pattern”We might attempt to explain why the “visitor” pattern got its name, but we believe this would confuse more than clarify; it is easier to write it off as a misnomer. and see some examples in Java, and then we will look at comparable code in Haskell. We will see that the Java code using visitors bears a strong resemblance to what we call sum types or tagged unions in Haskell.

Sign up for access to the full page, plus the complete archive and all the latest content.