More robust handling of cycles in object graphs

Type classes for which we generate queries and transformations
are now required to extend `Queryable[T, R]`. The `Queryable[T, R]`
trait declares an `apply` method with an additional parameter
(compared to the trait of the type class), which is passed the
set of visited objects. This extra method allows us to
distinguish between top-level invocations of type class methods
and inner invocations.

The only downside is that custom type class instances are
slightly more verbose to define, although the implementation
of `apply` can typically be a trivial forwarder.