-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | JSON pretty-printing library and command-line tool.
--   
--   A JSON pretty-printing library compatible with aeson as well as a
--   command-line tool to improve readabilty of streams of JSON data.
--   
--   The <i>library</i> provides the function "encodePretty". It is a
--   drop-in replacement for aeson's "encode" function, producing
--   JSON-ByteStrings for human readers.
--   
--   The <i>command-line tool</i> reads JSON from stdin and writes
--   prettified JSON to stdout. It also offers a complementary
--   "compact"-mode, essentially the opposite of pretty-printing. If you
--   specify <tt>-flib-only</tt> like this
--   
--   <pre>
--   cabal install -flib-only aeson-pretty
--   </pre>
--   
--   the command-line tool will NOT be installed.
@package aeson-pretty
@version 0.7.2


-- | Aeson-compatible pretty-printing of JSON <a>Value</a>s.
module Data.Aeson.Encode.Pretty

-- | A drop-in replacement for aeson's <a>encode</a> function, producing
--   JSON-ByteStrings for human readers.
--   
--   Follows the default configuration in <a>defConfig</a>.
encodePretty :: ToJSON a => a -> ByteString

-- | A drop-in replacement for aeson's <a>encodeToTextBuilder</a> function,
--   producing JSON-ByteStrings for human readers.
--   
--   Follows the default configuration in <a>defConfig</a>.
encodePrettyToTextBuilder :: ToJSON a => a -> Builder

-- | A variant of <a>encodePretty</a> that takes an additional
--   configuration parameter.
encodePretty' :: ToJSON a => Config -> a -> ByteString

-- | A variant of <tt>encodeToTextBuilder</tt> that takes an additional
--   configuration parameter.
encodePrettyToTextBuilder' :: ToJSON a => Config -> a -> Builder
data Config
Config :: Int -> (Text -> Text -> Ordering) -> Config

-- | Indentation spaces per level of nesting
[confIndent] :: Config -> Int

-- | Function used to sort keys in objects
[confCompare] :: Config -> Text -> Text -> Ordering

-- | The default configuration: indent by four spaces per level of nesting,
--   do not sort objects by key.
--   
--   <pre>
--   defConfig = Config { confIndent = 4, confCompare = mempty }
--   </pre>
defConfig :: Config

-- | Identity of <a>mappend</a>
mempty :: Monoid a => a
compare :: Ord a => a -> a -> Ordering

-- | Sort keys by their order of appearance in the argument list.
--   
--   Keys that are not present in the argument list are considered to be
--   greater than any key in the list and equal to all keys not in the
--   list. I.e. keys not in the argument list are moved to the end, while
--   their order is preserved.
keyOrder :: [Text] -> Text -> Text -> Ordering
