@@ -101,10 +101,7 @@ elab ist info pattern tcgen fn tm
101 (elab' ina (PRef fc unitTy))
101 (elab' ina (PRef fc unitTy))
102 elab' ina (PFalse fc) = elab' ina (PRef fc falseTy)
102 elab' ina (PFalse fc) = elab' ina (PRef fc falseTy)
103 elab' ina (PResolveTC (FC "HACK" _)) -- for chasing parent classes
103 elab' ina (PResolveTC (FC "HACK" _)) -- for chasing parent classes
105− -- let insts = filter tcname $ map fst (ctxtAlist (tt_ctxt ist))
106− let insts = findInstances ist t
107− resolveTC 2 fn insts ist
104+ = resolveTC 2 fn ist
108 elab' ina (PResolveTC fc) = do c <- unique_hole (MN 0 "c")
105 elab' ina (PResolveTC fc) = do c <- unique_hole (MN 0 "c")
109 instanceArg c
106 instanceArg c
110 elab' ina (PRefl fc) = elab' ina (PApp fc (PRef fc eqCon) [pimp (MN 0 "a") Placeholder,
107 elab' ina (PRefl fc) = elab' ina (PApp fc (PRef fc eqCon) [pimp (MN 0 "a") Placeholder,
@@ -240,9 +237,7 @@ elab ist info pattern tcgen fn tm
240 when (not pattern || (ina && not tcgen)) $
237 when (not pattern || (ina && not tcgen)) $
241 mapM_ (\n -> do focus n
238 mapM_ (\n -> do focus n
242 -- let insts = filter tcname $ map fst (ctxtAlist (tt_ctxt ist))
239 -- let insts = filter tcname $ map fst (ctxtAlist (tt_ctxt ist))
244− let insts = findInstances ist t
245− resolveTC 7 fn insts ist) (ivs' \\ ivs)
240+ resolveTC 7 fn ist) (ivs' \\ ivs)
246 where tcArg (n, PConstraint _ _ Placeholder) = True
241 where tcArg (n, PConstraint _ _ Placeholder) = True
247 tcArg _ = False
242 tcArg _ = False
@@ -359,12 +354,13 @@ findInstances ist t
360 | otherwise = []
355 | otherwise = []
362−resolveTC :: Int -> Name -> [Name] -> IState -> ElabD ()
357+resolveTC :: Int -> Name -> IState -> ElabD ()
363−resolveTC 0 fn insts ist = fail $ "Can't resolve type class"
358+resolveTC 0 fn ist = fail $ "Can't resolve type class"
364−resolveTC 1 fn insts ist = try (trivial ist) (resolveTC 0 fn insts ist)
359+resolveTC 1 fn ist = try (trivial ist) (resolveTC 0 fn ist)
365−resolveTC depth fn insts ist
360+resolveTC depth fn ist
366 = try (trivial ist)
361 = try (trivial ist)
367 (do t <- goal
362 (do t <- goal
363+ let insts = findInstances ist t
368 let (tc, ttypes) = unApply t
364 let (tc, ttypes) = unApply t
369 scopeOnly <- needsDefault t tc ttypes
365 scopeOnly <- needsDefault t tc ttypes
370 tm <- get_term
366 tm <- get_term
@@ -376,11 +372,11 @@ resolveTC depth fn insts ist
376 elabTC n | n /= fn && tcname n = (resolve n depth, show n)
372 elabTC n | n /= fn && tcname n = (resolve n depth, show n)
377 | otherwise = (fail "Can't resolve", show n)
373 | otherwise = (fail "Can't resolve", show n)
379− needsDefault t num@(P _ (NS (UN "Num") ["builtins"]) _) [P Bound a _]
375+-- needsDefault t num@(P _ (NS (UN "Num") ["builtins"]) _) [P Bound a _]
380− = do focus a
376+-- = do focus a
381− fill (RConstant IType) -- default Int
377+-- fill (RConstant IType) -- default Int
383− return False
379+-- return False
384 needsDefault t f as
380 needsDefault t f as
385 | all boundVar as = return True -- fail $ "Can't resolve " ++ show t
381 | all boundVar as = return True -- fail $ "Can't resolve " ++ show t
386 needsDefault t f a = return False -- trace (show t) $ return ()
382 needsDefault t f a = return False -- trace (show t) $ return ()
@@ -408,7 +404,7 @@ resolveTC depth fn insts ist
408 args <- apply (Var n) imps
404 args <- apply (Var n) imps
409-- traceWhen (all boundVar ttypes) ("Progress: " ++ show t ++ " with " ++ show n) $
405-- traceWhen (all boundVar ttypes) ("Progress: " ++ show t ++ " with " ++ show n) $
410 mapM_ (\ (_,n) -> do focus n
406 mapM_ (\ (_,n) -> do focus n
411− resolveTC (depth - 1) fn insts ist)
407+ resolveTC (depth - 1) fn ist)
412 (filter (\ (x, y) -> not x) (zip (map fst imps) args))
408 (filter (\ (x, y) -> not x) (zip (map fst imps) args))
413 -- if there's any arguments left, we've failed to resolve
409 -- if there's any arguments left, we've failed to resolve