-- 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.8.7

-- | 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 :: Indent -> (Text -> Text -> Ordering) -> NumberFormat -> Bool -> Config

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

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

-- | Whether to add a trailing newline to the output
[confTrailingNewline] :: Config -> Bool

-- | The default configuration: indent by four spaces per level of nesting,
--   do not sort objects by key, do not add trailing newline.
--   
--   
--   defConfig = Config { confIndent = Spaces 4, confCompare = mempty, confNumFormat = Generic, confTrailingNewline = False }
--   
defConfig :: Config

-- | Indentation per level of nesting. Spaces 0 removes
--   all whitespace from the output.
data Indent
Spaces :: Int -> Indent
Tab :: Indent
data NumberFormat

-- | The standard behaviour of the encode function. Uses integer
--   literals for integers (1, 2, 3...), simple decimals for fractional
--   values between 0.1 and 9,999,999, and scientific notation otherwise.
Generic :: NumberFormat

-- | Scientific notation (e.g. 2.3e123).
Scientific :: NumberFormat

-- | Standard decimal notation
Decimal :: NumberFormat

-- | Custom formatting function
Custom :: (Scientific -> Builder) -> NumberFormat

-- | 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
