optimise compilation of pattern-matching

but this is currently somewhat broken: treating Equality as an
unconditionally pure operator when it isn't; would need a more
fine-grained analysis of its arguments.