Understanding parametric polymorphism and generic code