@@ -1721,38 +1721,25 @@ resolveTC' di mv depth tm n ist
17211721
17221722collectDeferred :: Maybe Name -> [Name] -> Context ->
17231723 Term -> State [(Name, (Int, Maybe Name, Type, [Name]))] Term
1724−collectDeferred top casenames ctxt (Bind n (GHole i psns t) app) =
1725− do ds <- get
1726− t' <- collectDeferred top casenames ctxt t
1727− when (not (n `elem` map fst ds)) $ put (ds ++ [(n, (i, top, tidyArg [] t', psns))])
1728− collectDeferred top casenames ctxt app
1724+collectDeferred top casenames ctxt tm = cd [] tm
17291725 where
1730− -- Evaluate the top level functions in arguments, if possible, and if it's
1731− -- not a name we're immediately going to define in a case block, so that
1732− -- any immediate specialisation of the function applied to constructors
1733− -- can be done
1734− tidyArg env (Bind n b@(Pi im t k) sc)
1735− = Bind n (Pi im (tidy ctxt env t) k)
1736− (tidyArg ((n, b) : env) sc)
1737− tidyArg env t = tidy ctxt env t
1738−
1739− tidy ctxt env t = normalise ctxt env t
1740−
1741− getFn (Bind n (Lam _) t) = getFn t
1742− getFn t | (f, a) <- unApply t = f
1743−
1744−collectDeferred top ns ctxt (Bind n b t)
1745− = do b' <- cdb b
1746− t' <- collectDeferred top ns ctxt t
1747− return (Bind n b' t')
1748− where
1749− cdb (Let t v) = liftM2 Let (collectDeferred top ns ctxt t) (collectDeferred top ns ctxt v)
1750− cdb (Guess t v) = liftM2 Guess (collectDeferred top ns ctxt t) (collectDeferred top ns ctxt v)
1751− cdb b = do ty' <- collectDeferred top ns ctxt (binderTy b)
1752− return (b { binderTy = ty' })
1753−collectDeferred top ns ctxt (App s f a) = liftM2 (App s) (collectDeferred top ns ctxt f)
1754− (collectDeferred top ns ctxt a)
1755−collectDeferred top ns ctxt t = return t
1726+ cd env (Bind n (GHole i psns t) app) =
1727+ do ds <- get
1728+ t' <- collectDeferred top casenames ctxt t
1729+ when (not (n `elem` map fst ds)) $ put (ds ++ [(n, (i, top, t', psns))])
1730+ cd env app
1731+ cd env (Bind n b t)
1732+ = do b' <- cdb b
1733+ t' <- cd ((n, b) : env) t
1734+ return (Bind n b' t')
1735+ where
1736+ cdb (Let t v) = liftM2 Let (cd env t) (cd env v)
1737+ cdb (Guess t v) = liftM2 Guess (cd env t) (cd env v)
1738+ cdb b = do ty' <- cd env (binderTy b)
1739+ return (b { binderTy = ty' })
1740+ cd env (App s f a) = liftM2 (App s) (cd env f)
1741+ (cd env a)
1742+ cd env t = return t
17561743
17571744case_ :: Bool -> Bool -> IState -> Name -> PTerm -> ElabD ()
17581745case_ ind autoSolve ist fn tm = do