Add query for whether an object is an instance of a type

Targets #282.