1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Reporting.Exit.Compile
11import qualified Data.List as List
12import qualified Data.Text as Text
13import qualified Data.Time.Clock as Time
15import qualified Elm.Compiler as Compiler
16import qualified Elm.Compiler.Module as Module
17import qualified Json.Encode as Encode
18import qualified Reporting.Doc as D
29 , _time :: Time.UTCTime
30 , _source :: Text.Text
31 , _errors :: [Compiler.Error]
39toJson :: Exit -> Encode.Value
40toJson (Exit name path _ source errors) =
41 Compiler.errorsToJson name path source errors
48toDoc :: Exit -> [Exit] -> D.Doc
51 (exit, exits) = sortByTime e es
53 D.vcat (toDocHelp exit exits)
56toDocHelp :: Exit -> [Exit] -> [D.Doc]
63 exitToDoc e1 : separator (_name e1) (_name e2) : toDocHelp e2 otherErrors
66exitToDoc :: Exit -> D.Doc
67exitToDoc (Exit _name path _time source errors) =
68 Compiler.errorsToDoc path source errors
71separator :: Module.Raw -> Module.Raw -> D.Doc
72separator beforeName afterName =
74 before = Module.nameToString beforeName ++ " ↑ "
75 after = " ↓ " ++ Module.nameToString afterName
78 [ D.indent (80 - length before) (D.fromString before)
79 , "====o======================================================================o===="
90sortByTime :: Exit -> [Exit] -> (Exit, [Exit])
91sortByTime exit exits =
92 case List.sortBy timeCompare exits of
97 if _time exit < _time e then
100 (e, List.insertBy timeCompare exit es)
103timeCompare :: Exit -> Exit -> Ordering
105 compare (_time e1) (_time e2)
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