infer polymorphic types