comparison 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
comparison
equal deleted inserted replaced
1583:7fcdf836b761 1584:c37d8341940a
1233 | SgiStr (_, n, sgn) => Int.max (n, maxNameSgn sgn) 1233 | SgiStr (_, n, sgn) => Int.max (n, maxNameSgn sgn)
1234 | SgiSgn (_, n, sgn) => Int.max (n, maxNameSgn sgn) 1234 | SgiSgn (_, n, sgn) => Int.max (n, maxNameSgn sgn)
1235 | SgiConstraint _ => 0 1235 | SgiConstraint _ => 0
1236 | SgiClassAbs (_, n, _) => n 1236 | SgiClassAbs (_, n, _) => n
1237 | SgiClass (_, n, _, _) => n 1237 | SgiClass (_, n, _, _) => n
1238
1239 fun findDecl pred file =
1240 let
1241 fun decl d =
1242 let
1243 val r = case #1 d of
1244 DStr (_, _, _, s) => str s
1245 | _ => NONE
1246 in
1247 case r of
1248 NONE => if pred d then SOME d else NONE
1249 | _ => r
1250 end
1251
1252 and str s =
1253 case #1 s of
1254 StrConst ds => ListUtil.search decl ds
1255 | StrFun (_, _, _, _, s) => str s
1256 | StrApp (s1, s2) =>
1257 (case str s1 of
1258 NONE => str s2
1259 | r => r)
1260 | _ => NONE
1261 in
1262 ListUtil.search decl file
1263 end
1238 1264
1239 end 1265 end
1240 1266
1241 end 1267 end