@@ -478,12 +478,19 @@ fill guess ctxt env (Bind x (Hole ty) sc) =
478-- let valtyn = normalise ctxt env valty
478-- let valtyn = normalise ctxt env valty
479-- let tyn = normalise ctxt env ty
479-- let tyn = normalise ctxt env ty
480 ns <- unify' ctxt env (valty, Just $ SourceTerm val)
480 ns <- unify' ctxt env (valty, Just $ SourceTerm val)
481− (ty, Just ExpectedType)
481+ (ty, Just (chkPurpose val ty))
482 ps <- get
482 ps <- get
483 let (uh, uns) = unified ps
483 let (uh, uns) = unified ps
484-- put (ps { unified = (uh, uns ++ ns) })
484-- put (ps { unified = (uh, uns ++ ns) })
485-- addLog (show (uh, uns ++ ns))
485-- addLog (show (uh, uns ++ ns))
486 return $ Bind x (Guess ty val) sc
486 return $ Bind x (Guess ty val) sc
488+ -- some expected types show up commonly in errors and indicate a
489+ -- specific problem.
490+ -- argTy -> retTy suggests a function applied to too many arguments
491+ chkPurpose val (Bind _ (Pi _ (P _ (MN _ _) _) _) (P _ (MN _ _) _))
493+ chkPurpose _ _ = ExpectedType
487fill _ _ _ _ = fail "Can't fill here."
494fill _ _ _ _ = fail "Can't fill here."
489-- As fill, but attempts to solve other goals by matching
496-- As fill, but attempts to solve other goals by matching