Mercurial > urweb
diff src/elab_util.sml @ 1584:c37d8341940a
Shorter, more focused error messages about undetermined unification variables
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sat, 29 Oct 2011 17:30:34 -0400 |
parents | 9e0fa4f6ac93 |
children | 6c00d8af6239 |
line wrap: on
line diff
--- a/src/elab_util.sml Fri Oct 28 08:54:44 2011 -0400 +++ b/src/elab_util.sml Sat Oct 29 17:30:34 2011 -0400 @@ -1235,6 +1235,32 @@ | SgiConstraint _ => 0 | SgiClassAbs (_, n, _) => n | SgiClass (_, n, _, _) => n + +fun findDecl pred file = + let + fun decl d = + let + val r = case #1 d of + DStr (_, _, _, s) => str s + | _ => NONE + in + case r of + NONE => if pred d then SOME d else NONE + | _ => r + end + + and str s = + case #1 s of + StrConst ds => ListUtil.search decl ds + | StrFun (_, _, _, _, s) => str s + | StrApp (s1, s2) => + (case str s1 of + NONE => str s2 + | r => r) + | _ => NONE + in + ListUtil.search decl file + end end