[Git][ghc/ghc][master] Utils.JSON: do not escapeJsonString in ToJson String instance

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Oct 11 03:16:33 UTC 2022



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
ed4b5885 by Joachim Breitner at 2022-10-10T23:16:11-04:00
Utils.JSON: do not escapeJsonString in ToJson String instance

as `escapeJsonString` is used in `renderJSON`, so the `JSString`
constructor is meant to carry the unescaped string.

- - - - -


1 changed file:

- compiler/GHC/Utils/Json.hs


Changes:

=====================================
compiler/GHC/Utils/Json.hs
=====================================
@@ -14,6 +14,7 @@ data JsonDoc where
   JSBool :: Bool -> JsonDoc
   JSInt  :: Int  -> JsonDoc
   JSString :: String -> JsonDoc
+    -- ^ The 'String' is unescaped
   JSArray :: [JsonDoc] -> JsonDoc
   JSObject :: [(String, JsonDoc)] -> JsonDoc
 
@@ -57,7 +58,7 @@ class ToJson a where
   json :: a -> JsonDoc
 
 instance ToJson String where
-  json = JSString . escapeJsonString
+  json = JSString
 
 instance ToJson Int where
   json = JSInt



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ed4b5885bdac7b986655bb40f8c9ece2f8735c98

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ed4b5885bdac7b986655bb40f8c9ece2f8735c98
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221010/9dbad40d/attachment.html>


More information about the ghc-commits mailing list