1{-# LANGUAGE OverloadedStrings #-}
6 , Compile.Artifacts(..)
16import qualified Data.ByteString as BS
17import qualified Data.Map as Map
18import qualified Data.Text as Text
20import qualified Compile
21import qualified Elm.Compiler.Module as M
22import qualified Elm.Compiler.Version
23import qualified Elm.Package as Pkg
24import qualified Json.Encode as Encode
25import qualified Reporting.Doc as D
26import qualified Reporting.Error as Error
27import qualified Reporting.Render.Code as Code
28import qualified Reporting.Region as Region
29import qualified Reporting.Report as Report
30import qualified Reporting.Result as Result
31import qualified Reporting.Warning as Warning
40 Elm.Compiler.Version.version
49 { _package :: Pkg.Name
50 , _docsFlag :: Compile.DocsFlag
51 , _imports :: Map.Map M.Raw M.Canonical
52 , _interfaces :: M.Interfaces
56compile :: Context -> BS.ByteString -> ([Warning.Warning], Either [Error.Error] Compile.Artifacts)
57compile (Context pkg docsFlag importDict interfaces) source =
58 Result.run $ Compile.compile docsFlag pkg importDict interfaces source
65errorsToDoc :: FilePath -> Text.Text -> [Error.Error] -> D.Doc
66errorsToDoc filePath source errors =
69 concatMap (Error.toReports (Code.toSource source)) errors
71 D.vcat $ map (Report.toDoc filePath) reports
78errorsToJson :: M.Raw -> FilePath -> Text.Text -> [Error.Error] -> Encode.Value
79errorsToJson moduleName filePath source errors =
82 concatMap (Error.toReports (Code.toSource source)) errors
85 [ ("path", Encode.text (Text.pack filePath))
86 , ("name", Encode.name moduleName)
87 , ("problems", Encode.array (map reportToJson reports))
91reportToJson :: Report.Report -> Encode.Value
92reportToJson (Report.Report title region _sgstns message) =
94 [ ("title", Encode.text (Text.pack title))
95 , ("region", Region.encode region)
96 , ("message", D.encode message)
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