+\begin{code}
+matchFunTys
+ :: SDoc -- See Note [Herald for matchExpecteFunTys] in TcUnify
+ -> Arity
+ -> TcRhoType
+ -> ([TcSigmaType] -> TcRhoType -> TcM a)
+ -> TcM (HsWrapper, a)
+
+-- Written in CPS style for historical reasons;
+-- could probably be un-CPSd, like matchExpectedTyConApp
+
+matchFunTys herald arity res_ty thing_inside
+ = do { (coi, pat_tys, res_ty) <- matchExpectedFunTys herald arity res_ty
+ ; res <- thing_inside pat_tys res_ty
+ ; return (coiToHsWrapper (mkSymCoI coi), res) }
+\end{code}
+