# HG changeset patch # User Adam Chlipala # Date 1419360140 18000 # Node ID 0d898b086bbeac92d3c355dcbc4d59b080ae86e2 # Parent c647f113ba3ec7c7b7b462a5ff7da40c902236e8 Improve wildify heuristic for finding record type-class witnesses diff -r c647f113ba3e -r 0d898b086bbe src/elaborate.sml --- a/src/elaborate.sml Tue Dec 23 12:24:38 2014 -0500 +++ b/src/elaborate.sml Tue Dec 23 13:42:20 2014 -0500 @@ -3699,19 +3699,23 @@ fun should t = let val t = normClassConstraint env' t + + fun shouldR c = + case hnormCon env' c of + (L'.CApp (f, _), _) => + (case hnormCon env' f of + (L'.CApp (f, cl), loc) => + (case hnormCon env' f of + (L'.CMap _, _) => isClassOrFolder env' cl + | _ => false) + | _ => false) + | (L'.CConcat (c1, c2), _) => + shouldR c1 orelse shouldR c2 + | c => false in case #1 t of L'.CApp (f, _) => isClassOrFolder env' f - | L'.TRecord t => - (case hnormCon env' t of - (L'.CApp (f, _), _) => - (case hnormCon env' f of - (L'.CApp (f, cl), loc) => - (case hnormCon env' f of - (L'.CMap _, _) => isClassOrFolder env' cl - | _ => false) - | _ => false) - | _ => false) + | L'.TRecord t => shouldR t | _ => false end in