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.Report as Report
20 | Canonicalize Canonicalize.Error
26toReport :: Error -> Report.Report
30 Syntax.toReport syntaxError
32 Canonicalize canonicalizeError ->
33 Canonicalize.toReport canonicalizeError
36 Type.toReport typeError
41toString :: String -> String -> A.Located Error -> String
42toString location source (A.A region err) =
43 Report.toString location region (toReport err) source
46print :: String -> String -> A.Located Error -> IO ()
47print location source (A.A region err) =
48 Report.printError location region (toReport err) source
53toJson :: FilePath -> A.Located Error -> Json.Value
54toJson filePath (A.A region err) =
56 (maybeRegion, additionalFields) =
59 Report.toJson [] (Syntax.toReport syntaxError)
61 Canonicalize canonicalizeError ->
65 (\s -> ["suggestions" .= s])
66 (Canonicalize.extractSuggestions canonicalizeError)
68 Report.toJson suggestions (Canonicalize.toReport canonicalizeError)
71 Report.toJson [] (Type.toReport typeError)
75 , "region" .= maybe region id maybeRegion
76 , "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