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

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

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

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

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

-- | The standard behaviour of the <a>encode</a> 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 <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
