1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Reporting.Error where
5import Data.Aeson ((.=))
6import qualified Data.Aeson as Json
7import Prelude hiding (print)
9import qualified Reporting.Annotation as A
10import qualified Reporting.Error.Canonicalize as Canonicalize
11import qualified Reporting.Error.Syntax as Syntax
12import qualified Reporting.Error.Type as Type
13import qualified Reporting.PrettyPrint as P
14import qualified Reporting.Report as Report
21 | Canonicalize Canonicalize.Error
27toReport :: P.Dealiaser -> Error -> Report.Report
28toReport dealiaser err =
31 Syntax.toReport dealiaser syntaxError
33 Canonicalize canonicalizeError ->
34 Canonicalize.toReport dealiaser canonicalizeError
37 Type.toReport dealiaser typeError
42toString :: P.Dealiaser -> String -> String -> A.Located Error -> String
43toString dealiaser location source (A.A region err) =
44 Report.toString location region (toReport dealiaser err) source
47print :: P.Dealiaser -> String -> String -> A.Located Error -> IO ()
48print dealiaser location source (A.A region err) =
49 Report.printError location region (toReport dealiaser err) source
54toJson :: P.Dealiaser -> FilePath -> A.Located Error -> Json.Value
55toJson dealiaser filePath (A.A region err) =
57 (maybeRegion, additionalFields) =
60 Report.toJson [] (Syntax.toReport dealiaser syntaxError)
62 Canonicalize canonicalizeError ->
66 (\s -> ["suggestions" .= s])
67 (Canonicalize.extractSuggestions canonicalizeError)
69 Report.toJson suggestions (Canonicalize.toReport dealiaser canonicalizeError)
72 Report.toJson [] (Type.toReport dealiaser typeError)
77 , "subregion" .= maybeRegion
78 , "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