on master help sign in
Shuffle APIs to send compile errors through to command line
01a0b06Evan Czaplicki
builder/src/Reporting/Exit/Help.hs+5−5
@@ -22,7 +22,7 @@ import qualified Json.Encode as E
22import Json.Encode ((==>))
22import Json.Encode ((==>))
23import Reporting.Doc ((<+>))
23import Reporting.Doc ((<+>))
24import qualified Reporting.Doc as D
24import qualified Reporting.Doc as D
25−import qualified Reporting.Exit.Compile as Compile
25+import qualified Reporting.Error as Error
26
26
27
27
28
28
@@ -30,7 +30,7 @@ import qualified Reporting.Exit.Compile as Compile
30
30
31
31
32data Report
32data Report
33− = CompilerReport Compile.Exit [Compile.Exit]
33+ = CompilerReport Error.Module [Error.Module]
34 | Report
34 | Report
35 { _title :: String
35 { _title :: String
36 , _path :: Maybe FilePath
36 , _path :: Maybe FilePath
@@ -53,7 +53,7 @@ jsonReport =
53 Report
53 Report
54
54
55
55
56−compilerReport :: Compile.Exit -> [Compile.Exit] -> Report
56+compilerReport :: Error.Module -> [Error.Module] -> Report
57compilerReport =
57compilerReport =
58 CompilerReport
58 CompilerReport
59
59
@@ -66,7 +66,7 @@ reportToDoc :: Report -> D.Doc
66reportToDoc report_ =
66reportToDoc report_ =
67 case report_ of
67 case report_ of
68 CompilerReport e es ->
68 CompilerReport e es ->
69− Compile.toDoc e es
69+ Error.toDoc e es
70
70
71 Report title maybePath message ->
71 Report title maybePath message ->
72 let
72 let
@@ -98,7 +98,7 @@ reportToJson report_ =
98 CompilerReport e es ->
98 CompilerReport e es ->
99 E.object
99 E.object
100 [ "type" ==> E.string "compile-errors"
100 [ "type" ==> E.string "compile-errors"
101− , "errors" ==> E.list Compile.toJson (e:es)
101+ , "errors" ==> E.list Error.toJson (e:es)
102 ]
102 ]
103
103
104 Report title maybePath message ->
104 Report title maybePath message ->
compiler/src/Reporting/Error.hs+5−10
@@ -89,11 +89,11 @@ toReports source err =
89-- TO DOC
89-- TO DOC
90
90
91
91
92−toDoc :: NE.List Module -> D.Doc
92+toDoc :: Module -> [Module] -> D.Doc
93−toDoc modules =
93+toDoc err errs =
94 let
94 let
95 timeCompare m1 m2 = compare (_time m1) (_time m2)
95 timeCompare m1 m2 = compare (_time m1) (_time m2)
96− (NE.List m ms) = NE.sortBy timeCompare modules
96+ (NE.List m ms) = NE.sortBy timeCompare (NE.List err errs)
97 in
97 in
98 D.vcat (toDocHelp m ms)
98 D.vcat (toDocHelp m ms)
99
99
@@ -164,13 +164,8 @@ toMessageBar title filePath =
164-- TO JSON
164-- TO JSON
165
165
166
166
167−toJson :: NE.List Module -> E.Value
167+toJson :: Module -> E.Value
168−toJson modules =
169− E.array (map moduleToJson (NE.toList modules))
170−
171−
172−moduleToJson :: Module -> E.Value
173−moduleToJson (Module name path _ source err) =
168+toJson (Module name path _ source err) =
174 let
169 let
175 reports =
170 reports =
176 toReports (Code.toSource source) err
171 toReports (Code.toSource source) err