on master help sign in
Make formatting nicer for type errors
cb1a7a2Evan Czaplicki
compiler/Language/Elm.hs+1−1
@@ -31,7 +31,7 @@ import Paths_Elm
31compile :: String -> Either String String
31compile :: String -> Either String String
32compile source =
32compile source =
33 case buildFromSource False Prelude.interfaces source of
33 case buildFromSource False Prelude.interfaces source of
34− Left docs -> Left . unlines $ map P.render docs
34+ Left docs -> Left . unlines . List.intersperse "" $ map P.render docs
35 Right modul -> Right $ jsModule (modul :: MetadataModule () ())
35 Right modul -> Right $ jsModule (modul :: MetadataModule () ())
36
36
37-- |This function extracts the module name of a given source program.
37-- |This function extracts the module name of a given source program.
compiler/Type/State.hs+2−2
@@ -51,12 +51,12 @@ addError span message t1 t2 =
51
51
52 location =
52 location =
53 case span of
53 case span of
54− NoSpan msg -> if null msg then "" else "in\n\n " ++ msg
54+ NoSpan msg -> if null msg then "" else ":\n\n " ++ msg
55 Span p1 p2 msg -> lineNum ++ expr
55 Span p1 p2 msg -> lineNum ++ expr
56 where
56 where
57 lineNum = if line p1 == line p2 then "on line " ++ show (line p1)
57 lineNum = if line p1 == line p2 then "on line " ++ show (line p1)
58 else "between lines " ++ show (line p1) ++ " and " ++ show (line p2)
58 else "between lines " ++ show (line p1) ++ " and " ++ show (line p2)
59− expr = if null msg then "" else "\n\n " ++ msg
59+ expr = if null msg then "" else ":\n\n " ++ msg
60
60
61 makeError pt1 pt2 =
61 makeError pt1 pt2 =
62 P.vcat [ P.text $ "Type error " ++ location
62 P.vcat [ P.text $ "Type error " ++ location