@@ -190,6 +190,11 @@ pprintTerm ist = pprintTerm' ist []
190190pprintTerm' :: IState -> [(Name, Bool)] -> PTerm -> Doc OutputAnnotation
191191pprintTerm' ist bnd tm = pprintPTerm (ppOptionIst ist) bnd [] (idris_infixes ist) tm
192192
193+pprintProv :: IState -> [(Name, Term)] -> Provenance -> Doc OutputAnnotation
194+pprintProv i e ExpectedType = text "Expected type"
195+pprintProv i e (SourceTerm tm)
196+ = text "Type of " <> pprintTerm' i (zip (map fst e) (repeat False)) (delab i tm)
197+
193198pprintErr :: IState -> Err -> Doc OutputAnnotation
194199pprintErr i err = pprintErr' i (fmap (errReverse i) err)
195200
@@ -204,10 +209,18 @@ pprintErr' i (CantUnify _ (x_in, xprov) (y_in, yprov) e sc s) =
204209 (x, y) = addImplicitDiffs (delab i x_ns) (delab i y_ns) in
205210 text "Can't unify" <> indented (annTm x_ns
206211 (pprintTerm' i (map (\ (n, b) -> (n, False)) sc
207− ++ zip nms (repeat False)) x)) <$>
212+ ++ zip nms (repeat False)) x))
213+ <> case xprov of
214+ Nothing -> empty
215+ Just t -> text " (" <> pprintProv i sc t <> text ")"
216+ <$>
208217 text "with" <> indented (annTm y_ns
209218 (pprintTerm' i (map (\ (n, b) -> (n, False)) sc
210− ++ zip nms (repeat False)) y)) <>
219+ ++ zip nms (repeat False)) y))
220+ <> case yprov of
221+ Nothing -> empty
222+ Just t -> text " (" <> pprintProv i sc t <> text ")"
223+ <>
211224 case e of
212225 Msg "" -> empty
213226 -- if the specific error is the same as the one we just printed,