on master help sign in
Make formatting nicer for type errors
commitcb1a7a2355cb6fea5a3e3cb5c8afd55f1735a89a authorEvan Czaplicki <info@elm-lang.org> dateSat 3 Aug 2013, 12:02 (13 years ago) parent20047ec
2 files changed+3−3
compiler/Language/Elm.hs+1−1 compiler/Type/State.hs+2−2
compiler/Language/Elm.hs+1−1
@@ -31,7 +31,7 @@ import Paths_Elm
3131compile :: String -> Either String String
3232compile source =
3333 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
3535 Right modul -> Right $ jsModule (modul :: MetadataModule () ())
3636
3737-- |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 =
5151
5252 location =
5353 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
5555 Span p1 p2 msg -> lineNum ++ expr
5656 where
5757 lineNum = if line p1 == line p2 then "on line " ++ show (line p1)
5858 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
6060
6161 makeError pt1 pt2 =
6262 P.vcat [ P.text $ "Type error " ++ location