ghc-lib-parser-9.12.2.20250421: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Utils.Json

Synopsis

- data JsonDoc where
  - JSNull :: JsonDoc
  - JSBool :: Bool -> JsonDoc
  - JSInt :: Int -> JsonDoc
  - JSString :: String -> JsonDoc
  - JSArray :: [JsonDoc] -> JsonDoc
  - JSObject :: [(String, JsonDoc)] -> JsonDoc
- renderJSON :: JsonDoc -> SDoc
- escapeJsonString :: String -> String
- class ToJson a where
  - json :: a -> JsonDoc

# Documentation

data JsonDoc where Source #

Simple data type to represent JSON documents.

Constructors

JSNull :: JsonDoc |
JSBool :: Bool -> JsonDoc |
JSInt :: Int -> JsonDoc |
JSString |

Fields

- :: String
- -> JsonDoc

  The `String` is unescaped

JSArray :: [JsonDoc] -> JsonDoc |
JSObject :: [(String, JsonDoc)] -> JsonDoc |

renderJSON :: JsonDoc -> SDoc Source #

escapeJsonString :: String -> String Source #

class ToJson a where Source #

Methods

json :: a -> JsonDoc Source #

#### Instances

Instances details

ToJson DiagnosticCode Source # |
Instance details Defined in GHC.Types.Error Methods json :: DiagnosticCode -> JsonDoc Source #
ToJson MessageClass Source # |
Instance details Defined in GHC.Types.Error Methods json :: MessageClass -> JsonDoc Source #
ToJson Severity Source # |
Instance details Defined in GHC.Types.Error Methods json :: Severity -> JsonDoc Source #
ToJson RealSrcSpan Source # |
Instance details Defined in GHC.Types.SrcLoc Methods json :: RealSrcSpan -> JsonDoc Source #
ToJson SrcSpan Source # |
Instance details Defined in GHC.Types.SrcLoc Methods json :: SrcSpan -> JsonDoc Source #
ToJson String Source # |
Instance details Defined in GHC.Utils.Json Methods json :: String -> JsonDoc Source #
ToJson Int Source # |
Instance details Defined in GHC.Utils.Json Methods json :: Int -> JsonDoc Source #
Diagnostic e => ToJson (Messages e) Source # |
Instance details Defined in GHC.Types.Error Methods json :: Messages e -> JsonDoc Source #
Diagnostic e => ToJson (MsgEnvelope e) Source # |
Instance details Defined in GHC.Types.Error Methods json :: MsgEnvelope e -> JsonDoc Source #