rank-n polymorphism