on master help sign in
Trim the public API of Elm.Compiler for now

Will come back and add things when those things actually work.

commit9b630c1cb59834261546341efe303c468b2b433f authorEvan Czaplicki <evancz@users.noreply.github.com> dateTue 19 Dec 2017, 18:42 (9 years ago) parent78f5dc4
1 file changed+11−28
src/Elm/Compiler.hs+11−28
src/Elm/Compiler.hs+11−28
@@ -7,26 +7,25 @@ module Elm.Compiler
77 , Localizer
88 , dummyLocalizer
99 , Error.Error
10− , errorToDoc
11− , errorToJson
10+ , errorsToDoc
1211 , Warning.Warning
13− , warningToDoc
14− , warningToJson
1512 )
1613 where
1714
18−import qualified Data.Aeson as Json
15+
1916import qualified Data.ByteString as BS
2017import qualified Data.Map as Map
2118import qualified Data.Text as Text
22−import Text.PrettyPrint.ANSI.Leijen (Doc)
2319
2420import qualified Compile
2521import qualified Elm.Compiler.Module as M
2622import qualified Elm.Compiler.Version
2723import qualified Elm.Package as Pkg
2824import qualified Reporting.Error as Error
25+import qualified Reporting.Helpers as H
26+import qualified Reporting.Render.Code as Code
2927import qualified Reporting.Render.Type as RenderType
28+import qualified Reporting.Report as Report
3029import qualified Reporting.Result as Result
3130import qualified Reporting.Warning as Warning
3231
@@ -82,25 +81,9 @@ dummyLocalizer =
8281-- ERRORS
8382
8483
85−errorToDoc :: Localizer -> String -> Text.Text -> Error.Error -> Doc
86−errorToDoc (Localizer localizer) location source err =
87− error "TODO Report.toDoc" location (Error.toReport localizer err) source
88−
89−
90−errorToJson :: Localizer -> String -> Error.Error -> Json.Value
91−errorToJson (Localizer localizer) location err =
92− error "TODO Error.toJson" localizer location err
93−
94−
95−
96−-- WARNINGS
97−
98−
99−warningToDoc :: Localizer -> String -> Text.Text -> Warning.Warning -> Doc
100−warningToDoc (Localizer localizer) location source warning =
101− error "TODO Report.toDoc" location (Warning.toReport localizer warning) source
102−
103−
104−warningToJson :: Localizer -> String -> Warning.Warning -> Json.Value
105−warningToJson (Localizer localizer) location warning =
106− error "TODO Warning.toJson" localizer location warning
84+errorsToDoc :: FilePath -> Text.Text -> Localizer -> [Error.Error] -> H.Doc
85+errorsToDoc filePath source (Localizer localizer) errors =
86+ H.vcat $
87+ map
88+ (Report.toDoc filePath)
89+ (concatMap (Error.toReports (Code.toSource source) localizer) errors)