@@ -74,24 +74,20 @@ writeJSONChar c =
74 '\n' -> writeByteString "\\n"
74 '\n' -> writeByteString "\\n"
75 '\r' -> writeByteString "\\r"
75 '\r' -> writeByteString "\\r"
76 '\t' -> writeByteString "\\t"
76 '\t' -> writeByteString "\\t"
77− _ | c < '\x20' -> writeChar '\\' `mappend`
77+ _ | c < '\x20' -> writeByteString "\\u00" `mappend`
78− writeChar 'u' `mappend`
79− -- FIXME: Why do we have to use Word16 where Word8 would suffice?
80− writeWord16Hex (fromIntegral $ fromEnum c)
78+ writeWord8Hex (fromIntegral $ fromEnum c)
81 | otherwise -> writeChar c
79 | otherwise -> writeChar c
83-- TODO: Extend blaze-builder or better the new bytestring lib with support for
81-- TODO: Extend blaze-builder or better the new bytestring lib with support for
84-- hex encoding.
82-- hex encoding.
86−{-# INLINE writeWord16Hex #-}
84+{-# INLINE writeWord8Hex #-}
87−writeWord16Hex :: Word16 -> Write
85+writeWord8Hex :: Word8 -> Write
88−writeWord16Hex = exactWrite 4 . pokeWord16Hex
86+writeWord8Hex = exactWrite 2 . pokeWord8Hex
90−{-# INLINE pokeWord16Hex #-}
88+{-# INLINE pokeWord8Hex #-}
91−pokeWord16Hex :: Word16 -> Ptr Word8 -> IO ()
89+pokeWord8Hex :: Word8 -> Ptr Word8 -> IO ()
92−pokeWord16Hex x op = do
90+pokeWord8Hex x op = do
95 pokeNibble 2 4
91 pokeNibble 2 4
96 pokeNibble 3 0
92 pokeNibble 3 0
@@ -133,27 +129,5 @@ fromWriteStream write =
133fromWriteText :: (Char -> Write) -> T.Text -> Builder
129fromWriteText :: (Char -> Write) -> T.Text -> Builder
134fromWriteText w = fromWriteStream w . F.stream
130fromWriteText w = fromWriteStream w . F.stream
137−fromWriteList :: (a -> Write) -> [a] -> Builder
138−fromWriteList write =
141− makeBuilder xs0 = fromBuildStepCont $ step xs0
143− step xs1 k !(BufRange op0 ope0) = go xs1 op0
146− let !br' = BufRange op ope0
150− | op `plusPtr` maxSize <= ope0 = do
151− !op' <- runPoke wio op
153− | otherwise = return $ bufferFull maxSize op (step xs k)
155− Write maxSize wio = write x'
156−{-# INLINE fromWriteList #-}