-- 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 library provides the function "encodePretty". It is a
--   drop-in replacement for aeson's "encode" function, producing
--   JSON-ByteStrings for human readers.
--   
--   The command-line tool 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 -flib-only like this
--   
--   
--   cabal install -flib-only aeson-pretty
--   
--   
--   the command-line tool will NOT be installed.
@package aeson-pretty
@version 0.7.2

-- | Aeson-compatible pretty-printing of JSON Values.
module Data.Aeson.Encode.Pretty

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

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

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

-- | A variant of encodeToTextBuilder 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.
--   
--   
--   defConfig = Config { confIndent = 4, confCompare = mempty }
--   
defConfig :: Config

-- | Identity of mappend
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
