1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Reporting.Error where
5import Data.Aeson ((.=))
6import qualified Data.Aeson as Json
8import qualified Reporting.Annotation as A
9import qualified Reporting.Error.Canonicalize as Canonicalize
10import qualified Reporting.Error.Docs as Docs
11import qualified Reporting.Error.Pattern as Pattern
12import qualified Reporting.Error.Syntax as Syntax
13import qualified Reporting.Error.Type as Type
14import qualified Reporting.Render.Type as RenderType
15import qualified Reporting.Report as Report
24 | Canonicalize Canonicalize.Error
26 | Pattern Pattern.Error
34toReport :: RenderType.Localizer -> Error -> Report.Report
35toReport localizer err =
38 Syntax.toReport localizer syntaxError
40 Canonicalize canonicalizeError ->
41 Canonicalize.toReport localizer canonicalizeError
44 Type.toReport localizer typeError
46 Pattern patternError ->
47 Pattern.toReport localizer patternError
50 Docs.toReport docsError
57toJson :: RenderType.Localizer -> FilePath -> A.Located Error -> Json.Value
58toJson localizer filePath (A.A region err) =
60 (maybeRegion, additionalFields) =
63 Report.toJson [] (Syntax.toReport localizer syntaxError)
65 Canonicalize canonicalizeError ->
69 (\s -> ["suggestions" .= s])
70 (Canonicalize.extractSuggestions canonicalizeError)
72 Report.toJson suggestions (Canonicalize.toReport localizer canonicalizeError)
75 Report.toJson [] (Type.toReport localizer typeError)
77 Pattern patternError ->
78 Report.toJson [] (Pattern.toReport localizer patternError)
81 Report.toJson [] (Docs.toReport docsError)
86 , "subregion" .= maybeRegion
87 , "type" .= ("error" :: String)
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