@@ -615,9 +615,11 @@ resolveTC depth fn ist
615 if True -- all (\n -> not (n `elem` hs)) (freeNames g)
615 if True -- all (\n -> not (n `elem` hs)) (freeNames g)
616 then try' (trivial ist)
616 then try' (trivial ist)
617 (do t <- goal
617 (do t <- goal
618− let insts = findInstances ist t
619 let (tc, ttypes) = unApply t
618 let (tc, ttypes) = unApply t
620 scopeOnly <- needsDefault t tc ttypes
619 scopeOnly <- needsDefault t tc ttypes
620+ let insts_in = findInstances ist t
621+ let insts = if scopeOnly then filter chaser insts_in
621 tm <- get_term
623 tm <- get_term
622-- traceWhen (depth > 6) ("GOAL: " ++ show t ++ "\nTERM: " ++ show tm) $
624-- traceWhen (depth > 6) ("GOAL: " ++ show t ++ "\nTERM: " ++ show tm) $
623-- (tryAll (map elabTC (map fst (ctxtAlist (tt_ctxt ist)))))
625-- (tryAll (map elabTC (map fst (ctxtAlist (tt_ctxt ist)))))
@@ -633,6 +635,12 @@ resolveTC depth fn ist
633 elabTC n | n /= fn && tcname n = (resolve n depth, show n)
635 elabTC n | n /= fn && tcname n = (resolve n depth, show n)
634 | otherwise = (fail "Can't resolve", show n)
636 | otherwise = (fail "Can't resolve", show n)
638+ -- HACK! Rather than giving a special name, better to have some kind
639+ -- of flag in ClassInfo structure
640+ chaser (UN ('@':'@':_)) = True
641+ chaser (NS n _) = chaser n
636 needsDefault t num@(P _ (NS (UN "Num") ["Builtins"]) _) [P Bound a _]
644 needsDefault t num@(P _ (NS (UN "Num") ["Builtins"]) _) [P Bound a _]
637 = do focus a
645 = do focus a
638 fill (RConstant IType) -- default Int
646 fill (RConstant IType) -- default Int