@@ -86,14 +86,24 @@ match_unify ctxt env topx topy inj holes from =
86 return (map (renameBinders env) v')
86 return (map (renameBinders env) v')
87 _ -> tfail e
87 _ -> tfail e
89− -- This rule is highly dubious... it certainly produces a valid answer
90− -- but it scares me. However, matching is never guaranteed to give a unique
91− -- answer, merely a valid one, so perhaps we're okay.
92− -- In other words: it may vanish without warning some day :)
93 un :: [((Name, Name), TT Name)] -> TT Name -> TT Name ->
89 un :: [((Name, Name), TT Name)] -> TT Name -> TT Name ->
94 StateT UInfo
90 StateT UInfo
95 TC [(Name, TT Name)]
91 TC [(Name, TT Name)]
93+ -- This rule is highly dubious... it certainly produces a valid answer
94+ -- but it scares me. However, matching is never guaranteed to give a unique
95+ -- answer, merely a valid one, so perhaps we're okay.
96+ -- In other words: it may vanish without warning some day :)
97+ un names x tm@(App (P _ f (Bind fn (Pi _ t _) sc)) a)
98+ | (P (TCon _ _) _ _, _) <- unApply x,
99+ holeIn env f || f `elem` holes
100+ = let n' = uniqueName (sMN 0 "mv") (map fst env) in
101+ checkCycle names (f, Bind n' (Lam t) x)
102+ un names tm@(App (P _ f (Bind fn (Pi _ t _) sc)) a) x
103+ | (P (TCon _ _) _ _, _) <- unApply x,
104+ holeIn env f || f `elem` holes
105+ = let n' = uniqueName fn (map fst env) in
106+ checkCycle names (f, Bind n' (Lam t) x)
97 un names x tm@(App (P _ f (Bind fn (Pi _ t _) sc)) a)
107 un names x tm@(App (P _ f (Bind fn (Pi _ t _) sc)) a)
98 | (P (DCon _ _ _) _ _, _) <- unApply x,
108 | (P (DCon _ _ _) _ _, _) <- unApply x,
99 holeIn env f || f `elem` holes
109 holeIn env f || f `elem` holes