Pattern Matching

    Regulars have a name and age, whereas visitors only have a name. So we have our custom type, but how do we actually use it?

    The case expression allows us to branch based on which variant we happen to see, so whether we see Thomas or Kate, we always know how to show their name.

    Wild Cards

    The toName function we just defined works great, but notice that the age is not used in the implementation? When some of the associated data is unused, it is common to use a “wild card” instead of giving it a name: