WYRL: basically need to do a *lot* of work on optimising the types tests that are needed in a given pattern match.