1{-# LANGUAGE OverloadedStrings #-}
2module Reporting.Error where
4import Data.Aeson ((.=))
5import qualified Data.Aeson as Json
6import qualified Data.ByteString.Lazy.Char8 as BS
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.Region as R
19 | Canonicalize Canonicalize.Error
25toString :: String -> String -> A.Located Error -> String
26toString location source (A.A region err) =
32 , Syntax.toHint syntaxError
35 Canonicalize canonicalizeError ->
37 , Canonicalize.toHint canonicalizeError
42 , Type.toHint typeError
46 4 + length tag + 1 + length location
50 ++ replicate (max 1 (80 - usedSpace)) '-'
54 ++ R.select region source ++ "\n"
60toJson :: A.Located Error -> String
61toJson (A.A region err) =
65 Syntax.toJson syntaxError
67 Canonicalize canonicalizeError ->
68 Canonicalize.toJson canonicalizeError
73 BS.unpack $ Json.encode $
75 [ "tag" .= ("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