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.Syntax as Syntax
11import qualified Reporting.Error.Type as Type
12import qualified Reporting.Report as Report
19 | Canonicalize Canonicalize.Error
25toString :: String -> String -> A.Located Error -> String
26toString location source (A.A region err) =
31 Syntax.toReport syntaxError
33 Canonicalize canonicalizeError ->
34 Canonicalize.toReport canonicalizeError
37 Type.toReport typeError
39 Report.toString location region report source
44toJson :: FilePath -> A.Located Error -> Json.Value
45toJson filePath (A.A region err) =
47 (maybeRegion, additionalFields) =
50 Report.toJson [] (Syntax.toReport syntaxError)
52 Canonicalize canonicalizeError ->
56 (\s -> ["suggestions" .= s])
57 (Canonicalize.extractSuggestions canonicalizeError)
59 Report.toJson suggestions (Canonicalize.toReport canonicalizeError)
62 Report.toJson [] (Type.toReport typeError)
66 , "region" .= maybe region id maybeRegion
67 , "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