@@ -1202,7 +1202,10 @@ toEither (RightOK ho) = Right ho
1202-- and what they match. Returns the pair that failed if not a match.
1202-- and what they match. Returns the pair that failed if not a match.
1204matchClause :: PTerm -> PTerm -> Either (PTerm, PTerm) [(Name, PTerm)]
1204matchClause :: PTerm -> PTerm -> Either (PTerm, PTerm) [(Name, PTerm)]
1205+matchClause = matchClause' False
1207+matchClause' :: Bool -> PTerm -> PTerm -> Either (PTerm, PTerm) [(Name, PTerm)]
1205−matchClause x y = checkRpts $ match (fullApp x) (fullApp y) where
1208+matchClause' names x y = checkRpts $ match (fullApp x) (fullApp y) where
1206 matchArg x y = match (fullApp (getTm x)) (fullApp (getTm y))
1209 matchArg x y = match (fullApp (getTm x)) (fullApp (getTm y))
1208 fullApp (PApp _ (PApp fc f args) xs) = fullApp (PApp fc f (args ++ xs))
1211 fullApp (PApp _ (PApp fc f args) xs) = fullApp (PApp fc f (args ++ xs))
@@ -1219,7 +1222,7 @@ matchClause x y = checkRpts $ match (fullApp x) (fullApp y) where
1219 match (PRef f n) (PApp _ x []) = match (PRef f n) x
1222 match (PRef f n) (PApp _ x []) = match (PRef f n) x
1220 match (PApp _ x []) (PRef f n) = match x (PRef f n)
1223 match (PApp _ x []) (PRef f n) = match x (PRef f n)
1221 match (PRef _ n) (PRef _ n') | n == n' = return []
1224 match (PRef _ n) (PRef _ n') | n == n' = return []
1222− match (PRef _ n) tm = return [(n, tm)]
1225+ match (PRef _ n) tm | not names = return [(n, tm)]
1223 match (PEq _ l r) (PEq _ l' r') = do ml <- match' l l'
1226 match (PEq _ l r) (PEq _ l' r') = do ml <- match' l l'
1224 mr <- match' r r'
1227 mr <- match' r r'
1225 return (ml ++ mr)
1228 return (ml ++ mr)