@@ -478,12 +478,19 @@ fill guess ctxt env (Bind x (Hole ty) sc) =
478478-- let valtyn = normalise ctxt env valty
479479-- let tyn = normalise ctxt env ty
480480 ns <- unify' ctxt env (valty, Just $ SourceTerm val)
481− (ty, Just ExpectedType)
481+ (ty, Just (chkPurpose val ty))
482482 ps <- get
483483 let (uh, uns) = unified ps
484484-- put (ps { unified = (uh, uns ++ ns) })
485485-- addLog (show (uh, uns ++ ns))
486486 return $ Bind x (Guess ty val) sc
487+ where
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 _ _) _))
492+ = TooManyArgs val
493+ chkPurpose _ _ = ExpectedType
487494fill _ _ _ _ = fail "Can't fill here."
488495
489496-- As fill, but attempts to solve other goals by matching