+
+-- collect the bounds *value* variables in renamed patterns; type variables
+-- are *not* collected
+--
+collectOut (WildPat _) bndrs = bndrs
+collectOut (VarPat var) bndrs = var : bndrs
+collectOut (LazyPat pat) bndrs = collectOut pat bndrs
+collectOut (AsPat a pat) bndrs = a : collectOut pat bndrs
+collectOut (ListPat _ pats) bndrs = foldr collectOut bndrs pats
+collectOut (PArrPat _ pats) bndrs = foldr collectOut bndrs pats
+collectOut (TuplePat pats _) bndrs = foldr collectOut bndrs pats
+collectOut (ConPat _ _ _ ds pats) bndrs = ds ++ foldr collectOut bndrs pats
+collectOut (RecPat _ _ _ ds fields) bndrs = ds ++ foldr comb bndrs fields
+ where
+ comb (_, pat, _) bndrs = collectOut pat bndrs
+collectOut (LitPat _ _) bndrs = bndrs
+collectOut (NPat _ _ _) bndrs = bndrs
+collectOut (NPlusKPat n _ _ _ _) bndrs = n : bndrs
+collectOut (DictPat ids1 ids2) bndrs = ids1 ++ ids2 ++ bndrs