1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Reporting.Error.Compile
10import Data.List.NonEmpty (NonEmpty((:|)))
11import qualified Data.List.NonEmpty as NonEmpty
12import qualified Data.Text as Text
13import qualified Data.Time.Clock as Time
14import qualified Text.PrettyPrint.ANSI.Leijen as P
16import qualified Elm.Compiler as Compiler
17import qualified Elm.Compiler.Module as Module
28 , _time :: Time.UTCTime
29 , _source :: Text.Text
30 , _errors :: [Compiler.Error]
38toDoc :: Error -> [Error] -> P.Doc
40 case NonEmpty.sortWith _time (e :| es) of
42 P.vcat (toDocHelp err errors)
45toDocHelp :: Error -> [Error] -> [P.Doc]
52 errorToDoc e1 : separator (_name e1) (_name e2) : toDocHelp e2 otherErrors
55errorToDoc :: Error -> P.Doc
56errorToDoc (Error _name path _time source errors) =
57 Compiler.errorsToDoc path source errors
60separator :: Module.Raw -> Module.Raw -> P.Doc
61separator beforeName afterName =
63 before = Module.nameToString beforeName ++ " ↑ "
64 after = " ↓ " ++ Module.nameToString afterName
67 [ P.indent (80 - length before) (P.text before)
68 , "====o======================================================================o===="
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