Reasoning about functions with effects