@@ -16,20 +16,25 @@ import Core.Evaluate
17convertsC :: Context -> Env -> Term -> Term -> StateT UCs TC ()
17convertsC :: Context -> Env -> Term -> Term -> StateT UCs TC ()
18convertsC ctxt env x y
18convertsC ctxt env x y
19+ = do c1 <- convEq ctxt x y
19− = do c <- convEq ctxt (finalise (normalise ctxt env x))
22+ do c2 <- convEq ctxt (finalise (normalise ctxt env x))
20 (finalise (normalise ctxt env y))
23 (finalise (normalise ctxt env y))
21− if c then return ()
24+ if c2 then return ()
22− else lift $ tfail (CantConvert
25+ else lift $ tfail (CantConvert
23− (finalise (normalise ctxt env x))
26+ (finalise (normalise ctxt env x))
24− (finalise (normalise ctxt env y)) (errEnv env))
27+ (finalise (normalise ctxt env y)) (errEnv env))
26converts :: Context -> Env -> Term -> Term -> TC ()
29converts :: Context -> Env -> Term -> Term -> TC ()
31+ = if x == y then return () else
27−converts ctxt env x y = if (finalise (normalise ctxt env x) ==
32+ if (finalise (normalise ctxt env x) ==
28− finalise (normalise ctxt env y))
33+ finalise (normalise ctxt env y))
29− then return ()
34+ then return ()
30− else tfail (CantConvert
35+ else tfail (CantConvert
31− (finalise (normalise ctxt env x))
36+ (finalise (normalise ctxt env x))
32− (finalise (normalise ctxt env y)) (errEnv env))
37+ (finalise (normalise ctxt env y)) (errEnv env))
34errEnv = map (\(x, b) -> (x, binderTy b))
39errEnv = map (\(x, b) -> (x, binderTy b))
@@ -59,11 +64,16 @@ check' holes ctxt env top = chk env top where
59 chk env (RApp f a)
64 chk env (RApp f a)
60 = do (fv, fty) <- chk env f
65 = do (fv, fty) <- chk env f
61 (av, aty) <- chk env a
66 (av, aty) <- chk env a
67+ let fty' = case renameBinders 0 (finalise fty) of
68+ ty@(Bind x (Pi s) t) -> ty
62− let fty' = renameBinders 0 $ normalise ctxt env fty
69+ _ -> renameBinders 0 $ normalise ctxt env fty
63 case fty' of
70 case fty' of
64 Bind x (Pi s) t ->
71 Bind x (Pi s) t ->
65 do convertsC ctxt env aty s
72 do convertsC ctxt env aty s
66− let apty = normalise initContext env (Bind x (Let aty av) t)
73+ -- let apty = normalise initContext env
74+ -- (Bind x (Let aty av) t)
75+ let apty = simplify initContext False env
76+ (Bind x (Let aty av) t)
67 return (App fv av, apty)
77 return (App fv av, apty)
68 t -> fail "Can't apply a non-function type"
78 t -> fail "Can't apply a non-function type"
69 -- This rather unpleasant hack is needed because during incomplete
79 -- This rather unpleasant hack is needed because during incomplete