-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Fast and simple JSON encoding toolkit
--
-- Minimalistic library for encoding JSON directly to strict bytestring,
-- which is up to 3x faster than "aeson".
--
-- For introduction, benchmark results and demo please skip to Readme.
@package jsonifier
@version 0.1.2
-- | Simple DSL for mapping Haskell values into JSON representation and
-- rendering it into ByteString.
module Jsonifier
-- | Render a JSON value into strict bytestring.
toByteString :: Json -> ByteString
-- | Render a JSON value into Write.
toWrite :: Json -> Write
-- | Specification of how to render a JSON value to ByteString. Sort
-- of a JSON-specialized ByteString builder.
--
-- You can construct it from Haskell types using the specialized
-- conversion functions like intNumber, textString or
-- object. After constructing, you can convert to strict
-- ByteString using the toByteString function.
data Json
-- | JSON Null literal.
null :: Json
-- | JSON Boolean literal.
bool :: Bool -> Json
-- | JSON Number literal from Int.
intNumber :: Int -> Json
-- | JSON Number literal from Word.
wordNumber :: Word -> Json
-- | JSON Number literal from Double.
--
-- Since JSON doesn't have support for them, non-real values like
-- NaN, Infinity, -Infinity get rendered as
-- 0.
doubleNumber :: Double -> Json
-- | JSON Number literal from Scientific.
scientificNumber :: Scientific -> Json
-- | JSON String literal from Text.
textString :: Text -> Json
-- | JSON String literal from Scientific.
--
-- You may need this when the reader of your JSON cannot handle large
-- number literals.
scientificString :: Scientific -> Json
-- | JSON Array literal from a foldable over element literals.
--
-- Don't be afraid to use fmap to map the elements of the input
-- datastructure, it will all be optimized away.
array :: Foldable f => f Json -> Json
-- | JSON Object literal from a foldable over pairs of key to value
-- literal.
--
-- Don't be afraid to use fmap to map the elements of the input
-- datastructure, it will all be optimized away.
object :: Foldable f => f (Text, Json) -> Json
-- | 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
-- 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 -> Json