pattern-matching with labelled types