packages feed

jsonifier 0.1.0.6 → 0.1.1

raw patch · 3 files changed

+29/−5 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Jsonifier: writeJson :: Write -> Json

Files

jsonifier.cabal view
@@ -1,5 +1,5 @@ name: jsonifier-version: 0.1.0.6+version: 0.1.1 synopsis: Fast and simple JSON encoding toolkit description:   Minimalistic library for encoding JSON directly to strict bytestring,
library/Jsonifier.hs view
@@ -22,6 +22,8 @@   -- ** Composites   array,   object,+  -- ** Low-level+  writeJson, ) where @@ -212,3 +214,22 @@           Size.object count contentsSize         poke =           Poke.openingCurlyBracket <> bodyPoke <> Poke.closingCurlyBracket++{-|+Any JSON literal manually rendered as Write.++This is a low-level function allowing to avoid unnecessary processing+in cases where you already have a rendered JSON at hand.++You can think of Write as a specialized version of ByteString builder.+You can efficiently convert a ByteString to Write using 'PtrPoker.Write.byteString',+making it possible to have parts of the JSON value tree rendered using other libraries.+You can as well manually implement encoders for your custom types.++__Warning:__++It is your responsibility to ensure that the content is correct,+otherwise you may produce invalid JSON.+-}+writeJson :: Write.Write -> Json+writeJson = coerce
library/Jsonifier/Write.hs view
@@ -8,7 +8,10 @@  {-# INLINE scientificString #-} scientificString :: Scientific -> Write-scientificString a =-  case scientificAsciiDec a of-    Write size poke ->-      Write (size + 2) (Poke.doubleQuote <> poke <> Poke.doubleQuote)+scientificString =+  stringBody . scientificAsciiDec++{-# INLINE stringBody #-}+stringBody :: Write -> Write+stringBody (Write size poke) =+  Write (size + 2) (Poke.doubleQuote <> poke <> Poke.doubleQuote)