Instance checking and phantom types