Pattern matching in homotopy type theory