generalize products so index set can be any type