Sets, types and type checking