genKernel needs to control the type of Loc it passes to f (see code line 90).