@@ -369,8 +369,8 @@ intro n = processTactic' (Intro n)
369introTy :: Raw -> Maybe Name -> Elab' aux ()
369introTy :: Raw -> Maybe Name -> Elab' aux ()
370introTy ty n = processTactic' (IntroTy ty n)
370introTy ty n = processTactic' (IntroTy ty n)
372−forall :: Name -> Raw -> Elab' aux ()
372+forall :: Name -> Bool -> Raw -> Elab' aux ()
373−forall n t = processTactic' (Forall n t)
373+forall n i t = processTactic' (Forall n i t)
375letbind :: Name -> Raw -> Raw -> Elab' aux ()
375letbind :: Name -> Raw -> Raw -> Elab' aux ()
376letbind n t v = processTactic' (LetBind n t v)
376letbind n t v = processTactic' (LetBind n t v)
@@ -493,7 +493,9 @@ prepare_apply fn imps =
493 env <- get_env
493 env <- get_env
494 -- let claims = getArgs ty imps
494 -- let claims = getArgs ty imps
495 -- claims <- mkClaims (normalise ctxt env ty) imps []
495 -- claims <- mkClaims (normalise ctxt env ty) imps []
496− claims <- mkClaims (finalise ty) imps [] (map fst env)
496+ claims <- mkClaims (finalise ty)
497+ (normalise ctxt env (finalise ty))
498+ imps [] (map fst env)
497 ES (p, a) s prev <- get
499 ES (p, a) s prev <- get
498 -- reverse the claims we made so that args go left to right
500 -- reverse the claims we made so that args go left to right
499 let n = length (filter not imps)
501 let n = length (filter not imps)
@@ -502,11 +504,12 @@ prepare_apply fn imps =
502 return $! claims
504 return $! claims
504 mkClaims :: Type -- ^ The type of the operation being applied
506 mkClaims :: Type -- ^ The type of the operation being applied
507+ -> Type -- ^ Normalised version if we need it
505 -> [Bool] -- ^ Whether the arguments are implicit
508 -> [Bool] -- ^ Whether the arguments are implicit
506 -> [(Name, Name)] -- ^ Accumulator for produced claims
509 -> [(Name, Name)] -- ^ Accumulator for produced claims
507 -> [Name] -- ^ Hypotheses
510 -> [Name] -- ^ Hypotheses
508 -> Elab' aux [(Name, Name)] -- ^ The names of the arguments and their holes, resp.
511 -> Elab' aux [(Name, Name)] -- ^ The names of the arguments and their holes, resp.
509− mkClaims (Bind n' (Pi _ t_in _) sc) (i : is) claims hs =
512+ mkClaims (Bind n' (Pi _ t_in _) sc) (Bind _ _ scn) (i : is) claims hs =
510 do let t = rebind hs t_in
513 do let t = rebind hs t_in
511 n <- getNameFrom (mkMN n')
514 n <- getNameFrom (mkMN n')
512-- when (null claims) (start_unify n)
515-- when (null claims) (start_unify n)
@@ -514,9 +517,11 @@ prepare_apply fn imps =
514-- trace ("CLAIMING " ++ show (n, t) ++ " with " ++ show (fn, hs)) $
517-- trace ("CLAIMING " ++ show (n, t) ++ " with " ++ show (fn, hs)) $
515 claim n (forget t)
518 claim n (forget t)
516 when i (movelast n)
519 when i (movelast n)
517− mkClaims sc' is ((n', n) : claims) hs
520+ mkClaims sc' scn is ((n', n) : claims) hs
521+ -- if we run out of arguments, we need the normalised version...
522+ mkClaims t tn@(Bind _ _ sc) (i : is) cs hs = mkClaims tn tn (i : is) cs hs
518− mkClaims t [] claims _ = return $! (reverse claims)
523+ mkClaims t _ [] claims _ = return $! (reverse claims)
519− mkClaims _ _ _ _
524+ mkClaims _ _ _ _ _
520 | Var n <- fn
525 | Var n <- fn
521 = do ctxt <- get_context
526 = do ctxt <- get_context
522 case lookupTy n ctxt of
527 case lookupTy n ctxt of
@@ -693,11 +698,11 @@ simple_app fun arg appstr =
694-- Abstract over an argument of unknown type, giving a name for the hole
699-- Abstract over an argument of unknown type, giving a name for the hole
695-- which we'll fill with the argument type too.
700-- which we'll fill with the argument type too.
696−arg :: Name -> Name -> Elab' aux ()
701+arg :: Name -> Bool -> Name -> Elab' aux ()
697−arg n tyhole = do ty <- unique_hole tyhole
702+arg n i tyhole = do ty <- unique_hole tyhole
698− claim ty RType
703+ claim ty RType
699− movelast ty
704+ movelast ty
700− forall n (Var ty)
705+ forall n i (Var ty)
702-- try a tactic, if it adds any unification problem, return an error
707-- try a tactic, if it adds any unification problem, return an error
703no_errors :: Elab' aux () -> Maybe Err -> Elab' aux ()
708no_errors :: Elab' aux () -> Maybe Err -> Elab' aux ()