1{-# LANGUAGE OverloadedStrings #-}
6 , Compile.Artifacts(..)
16import qualified Data.ByteString as BS
17import qualified Data.Map as Map
18import qualified Data.Text as Text
19import qualified Text.PrettyPrint.ANSI.Leijen as P
21import qualified Compile
22import qualified Elm.Compiler.Module as M
23import qualified Elm.Compiler.Version
24import qualified Elm.Package as Pkg
25import qualified Json.Encode as Encode
26import qualified Reporting.Error as Error
27import qualified Reporting.Helpers as H
28import qualified Reporting.Render.Code as Code
29import qualified Reporting.Region as Region
30import qualified Reporting.Report as Report
31import qualified Reporting.Result as Result
32import qualified Reporting.Warning as Warning
41 Elm.Compiler.Version.version
50 { _package :: Pkg.Name
51 , _docsFlag :: Compile.DocsFlag
52 , _imports :: Map.Map M.Raw M.Canonical
53 , _interfaces :: M.Interfaces
57compile :: Context -> BS.ByteString -> ([Warning.Warning], Either [Error.Error] Compile.Artifacts)
58compile (Context pkg docsFlag importDict interfaces) source =
59 Result.run $ Compile.compile docsFlag pkg importDict interfaces source
66errorsToDoc :: FilePath -> Text.Text -> [Error.Error] -> H.Doc
67errorsToDoc filePath source errors =
70 concatMap (Error.toReports (Code.toSource source) Map.empty) errors
72 H.vcat $ map (Report.toDoc filePath) reports
79errorsToJson :: M.Raw -> FilePath -> Text.Text -> [Error.Error] -> Encode.Value
80errorsToJson moduleName filePath source errors =
83 concatMap (Error.toReports (Code.toSource source) Map.empty) errors
86 [ ("path", Encode.text (Text.pack filePath))
87 , ("name", Encode.name moduleName)
88 , ("errors", Encode.array (map reportToJson reports))
92reportToJson :: Report.Report -> Encode.Value
93reportToJson (Report.Report title region _sgstns message) =
96 P.displayS (P.renderPretty 1 80 message) ""
99 [ ("title", Encode.text (Text.pack title))
100 , ("region", Region.encode region)
101 , ("message", Encode.text (Text.pack messageString))
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list