@@ -369,8 +369,8 @@ intro n = processTactic' (Intro n)
369369introTy :: Raw -> Maybe Name -> Elab' aux ()
370370introTy ty n = processTactic' (IntroTy ty n)
371371
372−forall :: Name -> Raw -> Elab' aux ()
373−forall n t = processTactic' (Forall n t)
372+forall :: Name -> Bool -> Raw -> Elab' aux ()
373+forall n i t = processTactic' (Forall n i t)
374374
375375letbind :: Name -> Raw -> Raw -> Elab' aux ()
376376letbind n t v = processTactic' (LetBind n t v)
@@ -493,7 +493,9 @@ prepare_apply fn imps =
493493 env <- get_env
494494 -- let claims = getArgs ty imps
495495 -- 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)
497499 ES (p, a) s prev <- get
498500 -- reverse the claims we made so that args go left to right
499501 let n = length (filter not imps)
@@ -502,11 +504,12 @@ prepare_apply fn imps =
502504 return $! claims
503505 where
504506 mkClaims :: Type -- ^ The type of the operation being applied
507+ -> Type -- ^ Normalised version if we need it
505508 -> [Bool] -- ^ Whether the arguments are implicit
506509 -> [(Name, Name)] -- ^ Accumulator for produced claims
507510 -> [Name] -- ^ Hypotheses
508511 -> 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 =
510513 do let t = rebind hs t_in
511514 n <- getNameFrom (mkMN n')
512515-- when (null claims) (start_unify n)
@@ -514,9 +517,11 @@ prepare_apply fn imps =
514517-- trace ("CLAIMING " ++ show (n, t) ++ " with " ++ show (fn, hs)) $
515518 claim n (forget t)
516519 when i (movelast n)
517− mkClaims sc' is ((n', n) : claims) hs
518− mkClaims t [] claims _ = return $! (reverse claims)
519− mkClaims _ _ _ _
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
523+ mkClaims t _ [] claims _ = return $! (reverse claims)
524+ mkClaims _ _ _ _ _
520525 | Var n <- fn
521526 = do ctxt <- get_context
522527 case lookupTy n ctxt of
@@ -693,11 +698,11 @@ simple_app fun arg appstr =
693698
694699-- Abstract over an argument of unknown type, giving a name for the hole
695700-- which we'll fill with the argument type too.
696−arg :: Name -> Name -> Elab' aux ()
697−arg n tyhole = do ty <- unique_hole tyhole
698− claim ty RType
699− movelast ty
700− forall n (Var ty)
701+arg :: Name -> Bool -> Name -> Elab' aux ()
702+arg n i tyhole = do ty <- unique_hole tyhole
703+ claim ty RType
704+ movelast ty
705+ forall n i (Var ty)
701706
702707-- try a tactic, if it adds any unification problem, return an error
703708no_errors :: Elab' aux () -> Maybe Err -> Elab' aux ()