on master help sign in
A localizer cannot always be produced
4914a41Evan Czaplicki
src/Elm/Compiler.hs+5−24
@@ -4,8 +4,6 @@ module Elm.Compiler
4 , Context(..)
4 , Context(..)
5 , Compile.Artifacts(..)
5 , Compile.Artifacts(..)
6 , compile
6 , compile
7− , Localizer
8− , dummyLocalizer
9 , Error.Error
7 , Error.Error
10 , errorsToDoc
8 , errorsToDoc
11 , Warning.Warning
9 , Warning.Warning
@@ -24,7 +22,6 @@ import qualified Elm.Package as Pkg
24import qualified Reporting.Error as Error
22import qualified Reporting.Error as Error
25import qualified Reporting.Helpers as H
23import qualified Reporting.Helpers as H
26import qualified Reporting.Render.Code as Code
24import qualified Reporting.Render.Code as Code
27−import qualified Reporting.Render.Type as RenderType
28import qualified Reporting.Report as Report
25import qualified Reporting.Report as Report
29import qualified Reporting.Result as Result
26import qualified Reporting.Result as Result
30import qualified Reporting.Warning as Warning
27import qualified Reporting.Warning as Warning
@@ -52,38 +49,22 @@ data Context =
52 }
49 }
53
50
54
51
55−compile :: Context -> BS.ByteString -> (Localizer, [Warning.Warning], Either [Error.Error] Compile.Artifacts)
52+compile :: Context -> BS.ByteString -> ([Warning.Warning], Either [Error.Error] Compile.Artifacts)
56compile (Context pkg exposed importDict interfaces) source =
53compile (Context pkg exposed importDict interfaces) source =
57 let
54 let
58 docsFlag =
55 docsFlag =
59 if exposed then Compile.YesDocs else Compile.NoDocs
56 if exposed then Compile.YesDocs else Compile.NoDocs
60−
61− (warnings, errorOrArtifacts) =
62− Result.run $ Compile.compile docsFlag pkg importDict interfaces source
63 in
57 in
64− ( dummyLocalizer, warnings, errorOrArtifacts )
58+ Result.run $ Compile.compile docsFlag pkg importDict interfaces source
65−
66−
67−
68−-- DEALIASER
69−
70−
71−newtype Localizer =
72− Localizer RenderType.Localizer
73−
74−
75−dummyLocalizer :: Localizer
76−dummyLocalizer =
77− Localizer Map.empty
78
59
79
60
80
61
81-- ERRORS
62-- ERRORS
82
63
83
64
84−errorsToDoc :: FilePath -> Text.Text -> Localizer -> [Error.Error] -> H.Doc
65+errorsToDoc :: FilePath -> Text.Text -> [Error.Error] -> H.Doc
85−errorsToDoc filePath source (Localizer localizer) errors =
66+errorsToDoc filePath source errors =
86 H.vcat $
67 H.vcat $
87 map
68 map
88 (Report.toDoc filePath)
69 (Report.toDoc filePath)
89− (concatMap (Error.toReports (Code.toSource source) localizer) errors)
70+ (concatMap (Error.toReports (Code.toSource source) Map.empty) errors)