Designing Using Type Classes

We're now going to design a good portion of the parser interface by using the common type classes as inspiration. One view of type classes is that we implement them because doing gives us a range of methods "for free". A different view is that the type class abstractions exist because they capture common patterns, so when we implement our own systems we can look to the type classes for inspiration. This is the approach we're taking here, though we'll also benefit from the additional methods that type classes instances bring.

Your tasks are to:

To get started I'll show you how to do the first one, Functor.

Functor→