@@ -3,6 +3,7 @@ module Reporting.Exit.Help
33 ( Report
44 , report
55 , docReport
6+ , jsonReport
67 , compilerReport
78 , reportToDoc
89 , reportToJson
@@ -27,6 +28,7 @@ import Text.PrettyPrint.ANSI.Leijen ((<>),(<+>))
2728import qualified Elm.Compiler as Compiler
2829import qualified Elm.Package as Pkg
2930import qualified Json.Encode as Encode
31+import qualified Reporting.Exit.Compile as Compile
3032
3133
3234
@@ -34,7 +36,7 @@ import qualified Json.Encode as Encode
3436
3537
3638data Report
37− = CompileErrors
39+ = CompilerReport Compile.Exit [Compile.Exit]
3840 | Report
3941 { _title :: String
4042 , _path :: Maybe FilePath
@@ -52,9 +54,14 @@ docReport title path startDoc others =
5254 Report title path $ stack (startDoc:others)
5355
5456
55−compilerReport :: P.Doc -> Report
57+jsonReport :: String -> Maybe FilePath -> P.Doc -> Report
58+jsonReport =
59+ Report
60+
61+
62+compilerReport :: Compile.Exit -> [Compile.Exit] -> Report
5663compilerReport =
57− error "TODO compilerReport"
64+ CompilerReport
5865
5966
6067
@@ -64,8 +71,8 @@ compilerReport =
6471reportToDoc :: Report -> P.Doc
6572reportToDoc report_ =
6673 case report_ of
67− CompileErrors ->
68− error "TODO reportToDoc"
74+ CompilerReport e es ->
75+ Compile.toDoc e es
6976
7077 Report title maybePath message ->
7178 let
@@ -94,8 +101,11 @@ reportToDoc report_ =
94101reportToJson :: Report -> Encode.Value
95102reportToJson report_ =
96103 case report_ of
97− CompileErrors ->
98− error "TODO reportToJson"
104+ CompilerReport e es ->
105+ Encode.object
106+ [ ("type", Encode.text "compile-errors")
107+ , ("errors", Encode.list Compile.toJson (e:es))
108+ ]
99109
100110 Report title maybePath message ->
101111 let