@@ -88,23 +88,24 @@ text t = B.char8 '"' <> unquoted t <> B.char8 '"'
88-- | Encode a JSON string, without enclosing quotes.
88-- | Encode a JSON string, without enclosing quotes.
89unquoted :: T.Text -> Builder
89unquoted :: T.Text -> Builder
90unquoted t = TE.encodeUtf8BuilderEscaped escapeAscii t
90unquoted t = TE.encodeUtf8BuilderEscaped escapeAscii t
92− escapeAscii :: BP.BoundedPrim Word8
94− BP.condB (== c2w '\\' ) (ascii2 ('\\','\\')) $
95− BP.condB (== c2w '\"' ) (ascii2 ('\\','"' )) $
96− BP.condB (>= c2w '\x20') (BP.liftFixedToBounded BP.word8) $
97− BP.condB (== c2w '\n' ) (ascii2 ('\\','n' )) $
98− BP.condB (== c2w '\r' ) (ascii2 ('\\','r' )) $
99− BP.condB (== c2w '\t' ) (ascii2 ('\\','t' )) $
100− (BP.liftFixedToBounded hexEscape) -- fallback for chars < 0x20
102− c2w = fromIntegral . ord
92+escapeAscii :: BP.BoundedPrim Word8
94+ BP.condB (== c2w '\\' ) (ascii2 ('\\','\\')) $
95+ BP.condB (== c2w '\"' ) (ascii2 ('\\','"' )) $
96+ BP.condB (>= c2w '\x20') (BP.liftFixedToBounded BP.word8) $
97+ BP.condB (== c2w '\n' ) (ascii2 ('\\','n' )) $
98+ BP.condB (== c2w '\r' ) (ascii2 ('\\','r' )) $
99+ BP.condB (== c2w '\t' ) (ascii2 ('\\','t' )) $
100+ (BP.liftFixedToBounded hexEscape) -- fallback for chars < 0x20
104 hexEscape :: BP.FixedPrim Word8
102 hexEscape :: BP.FixedPrim Word8
105 hexEscape = (\c -> ('\\', ('u', fromIntegral c))) BP.>$<
103 hexEscape = (\c -> ('\\', ('u', fromIntegral c))) BP.>$<
106 BP.char8 >*< BP.char8 >*< BP.word16HexFixed
104 BP.char8 >*< BP.char8 >*< BP.word16HexFixed
107+c2w c = fromIntegral (ord c)
108-- | Encode a JSON number.
109-- | Encode a JSON number.
109number :: Scientific -> Builder
110number :: Scientific -> Builder