More partial evaluation improvements

Propagate staticness into where blocks, make constraints on instances
static, and generalise over functions in types to make the partially
evaluated version as general as possible.