Generalising the demand analysis to sum types