Copyright | (c) Mesabloo 2021 |
---|---|
License | BSD3 |
Stability | experimental |
Portability | Portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- stdout :: Handle
- stderr :: Handle
- def :: Default a => a
- data Diagnostic msg
- printDiagnostic :: (MonadIO m, Pretty msg) => Handle -> Bool -> Bool -> Int -> Diagnostic msg -> m ()
- addFile :: Diagnostic msg -> FilePath -> String -> Diagnostic msg
- addReport :: Diagnostic msg -> Report msg -> Diagnostic msg
- diagnosticToJson :: ToJSON msg => Diagnostic msg -> ByteString
Re-exports
data Diagnostic msg Source #
The data type for diagnostic containing messages of an abstract type.
The constructors are private, but users can use def
from the Default
typeclass
to create a new empty diagnostic, and addFile
and addReport
to alter its internal state.
Instances
Semigroup (Diagnostic msg) Source # | |
Defined in Error.Diagnose.Diagnostic.Internal (<>) :: Diagnostic msg -> Diagnostic msg -> Diagnostic msg # sconcat :: NonEmpty (Diagnostic msg) -> Diagnostic msg # stimes :: Integral b => b -> Diagnostic msg -> Diagnostic msg # | |
ToJSON msg => ToJSON (Diagnostic msg) Source # | |
Defined in Error.Diagnose.Diagnostic.Internal toJSON :: Diagnostic msg -> Value # toEncoding :: Diagnostic msg -> Encoding # toJSONList :: [Diagnostic msg] -> Value # toEncodingList :: [Diagnostic msg] -> Encoding # | |
Default (Diagnostic msg) Source # | |
Defined in Error.Diagnose.Diagnostic.Internal def :: Diagnostic msg # |
:: (MonadIO m, Pretty msg) | |
=> Handle | The handle onto which to output the diagnostic. |
-> Bool | Should we print with unicode characters? |
-> Bool |
|
-> Int | The number of spaces each TAB character will span. |
-> Diagnostic msg | The diagnostic to output. |
-> m () |
Prints a Diagnostic
onto a specific Handle
.
:: Diagnostic msg | |
-> FilePath | The path to the file. |
-> String | The content of the file as a single string, where lines are ended by |
-> Diagnostic msg |
Inserts a new referenceable file within the diagnostic.
:: Diagnostic msg | |
-> Report msg | The new report to add to the diagnostic. |
-> Diagnostic msg |
Inserts a new report into a diagnostic.
diagnosticToJson :: ToJSON msg => Diagnostic msg -> ByteString Source #
Creates a JSON object from a diagnostic, containing those fields (only types are indicated):
{ files: { name: string , content: string[] }[] , reports: { kind: 'error' | 'warning' , code: T? , message: T , markers: { kind: 'this' | 'where' | 'maybe' , position: { beginning: { line: int, column: int } , end: { line: int, column: int } , file: string } , message: T }[] , hints: T[] }[] }
where T
is the type of the JSON representation for the msg
type variable.