@@ -51,11 +51,13 @@ addError span message t1 t2 =
5151
5252 location =
5353 case span of
54− NoSpan -> ""
55− Span p1 p2 ->
56− if line p1 == line p2 then "on line " ++ show (line p1)
57− else "between lines " ++ show (line p1) ++ " and " ++ show (line p2)
58−
54+ NoSpan msg -> if null msg then "" else "in\n\n " ++ msg
55+ Span p1 p2 msg -> lineNum ++ expr
56+ where
57+ lineNum = if line p1 == line p2 then "on line " ++ show (line p1)
58+ else "between lines " ++ show (line p1) ++ " and " ++ show (line p2)
59+ expr = if null msg then "" else "\n\n " ++ msg
60+
5961 makeError pt1 pt2 =
6062 P.vcat [ P.text $ "Type error " ++ location
6163 , if null message then empty else P.vcat . map P.text $ lines message