Updating immutable objects in generic contexts.