@@ -1378,7 +1378,7 @@ pruneByType env t c as
13781378
13791379pruneByType env (P _ n _) ctxt as
13801380-- if the goal type is polymorphic, keep e
1381− | [] <- lookupTy n ctxt = as
1381+ | Nothing <- lookupTyExact n ctxt = as
13821382 | otherwise
13831383 = let asV = filter (headIs True n) as
13841384 as' = filter (headIs False n) as in
@@ -1388,16 +1388,17 @@ pruneByType env (P _ n _) ctxt as
13881388 _ -> asV
13891389 _ -> as'
13901390 where
1391+ headIs var f (PRef _ f') = typeHead var f f'
13911392 headIs var f (PApp _ (PRef _ f') _) = typeHead var f f'
13921393 headIs var f (PApp _ f' _) = headIs var f f'
13931394 headIs var f (PPi _ _ _ _ sc) = headIs var f sc
13941395 headIs var f (PHidden t) = headIs var f t
1395− headIs _ _ _ = True -- keep if it's not an application
1396+ headIs var f t = True -- keep if it's not an application
13961397
13971398 typeHead var f f'
13981399 = -- trace ("Trying " ++ show f' ++ " for " ++ show n) $
1399− case lookupTy f' ctxt of
1400− [ty] -> case unApply (getRetTy ty) of
1400+ case lookupTyExact f' ctxt of
1401+ Just ty -> case unApply (getRetTy ty) of
14011402 (P _ ctyn _, _) | isConName ctyn ctxt -> ctyn == f
14021403 _ -> let ty' = normalise ctxt [] ty in
14031404 case unApply (getRetTy ty') of