port partition function to new types