1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Reporting.Exit.Compile
11import qualified Data.List as List
12import qualified Data.Time.Clock as Time
14import qualified Elm.Compiler as Compiler
15import qualified Elm.ModuleName as ModuleName
16import qualified Json.Encode as Encode
17import qualified Reporting.Doc as D
26 { _name :: ModuleName.Raw
28 , _time :: Time.UTCTime
30 , _errors :: [Compiler.Error]
38toJson :: Exit -> Encode.Value
39toJson (Exit name path _ source errors) =
40 Compiler.errorsToJson name path source errors
47toDoc :: Exit -> [Exit] -> D.Doc
50 (exit, exits) = sortByTime e es
52 D.vcat (toDocHelp exit exits)
55toDocHelp :: Exit -> [Exit] -> [D.Doc]
62 exitToDoc e1 : separator (_name e1) (_name e2) : toDocHelp e2 otherErrors
65exitToDoc :: Exit -> D.Doc
66exitToDoc (Exit _name path _time source errors) =
67 Compiler.errorsToDoc path source errors
70separator :: ModuleName.Raw -> ModuleName.Raw -> D.Doc
71separator beforeName afterName =
73 before = ModuleName.nameToChars beforeName ++ " ↑ "
74 after = " ↓ " ++ ModuleName.nameToChars afterName
77 [ D.indent (80 - length before) (D.fromChars before)
78 , "====o======================================================================o===="
89sortByTime :: Exit -> [Exit] -> (Exit, [Exit])
90sortByTime exit exits =
91 case List.sortBy timeCompare exits of
96 if _time exit < _time e then
99 (e, List.insertBy timeCompare exit es)
102timeCompare :: Exit -> Exit -> Ordering
104 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