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


-- | Pretty printer and exporter for configurations from
--   the "configurator" library.
--   
--   Pretty printers and exporters for <a>Config</a>s from the
--   <a>configurator</a> library, in <a>Data.Configurator</a>.
--   
--   All results are intended to be valid parsing files in the
--   configuration file syntax of the library.
--   
--   For a full round trip:
--   
--   <pre>
--   main = do
--     cfg &lt;- load [Required "config.cfg"]
--     writeConf "config.cfg" cfg
--   </pre>
--   
--   This should load the config file, parse it, and then re-export it,
--   rewriting the original config file. The result should be an identical
--   configuration file (with keys potentially re-arranged and re-sorted,
--   comments removed, etc.)
--   
--   See the <a>Data.Configurator.Export</a> module for more details and
--   ways to modify the output style.
@package configurator-export
@version 0.1.0.1


-- | Pretty printers and exporters for <a>Config</a>s from the
--   <i>configurator</i> library, in <a>Data.Configurator</a>.
--   
--   All results are intended to be valid parsing files in the
--   configuration file syntax of the library.
--   
--   For a full round trip:
--   
--   <pre>
--   main = do
--     cfg &lt;- load [Required "config.cfg"]
--     writeConf "config.cfg" cfg
--   </pre>
--   
--   This should load the config file, parse it, and then re-export it,
--   rewriting the original config file. The result should be an identical
--   configuration file (with keys potentially re-arranged and re-sorted,
--   comments removed, etc.)
--   
--   Print/export your own dynmically generated configuration files by
--   manipulating the <tt><a>HashMap</a> <a>Name</a> <a>Value</a></tt> that
--   a <a>Config</a> gives with <a>getMap</a>.
--   
--   Sample output:
--   
--   <pre>
--   foo {
--       bar {
--           baz1  = true
--           baz2  = [1, 0.6, "hello", true]
--       }
--       aardvark  = "banana"
--       monkey    = [true, false, 1.9e-3]
--       zebra     = 24
--   }
--   
--   foo2 {
--       bar = 8.1e-8
--   }
--   
--   apple   = ["cake", true]
--   orange  = 8943
--   </pre>
--   
--   Further configuration on sorting of keys, displaying of bools and
--   floats, etc. is possible by passing in custom <a>ConfStyle</a> values.
module Data.Configurator.Export

-- | Render/pretty print the current contents of the given <a>Config</a> to
--   a <a>String</a>.
renderConf :: Config -> IO String

-- | Print out a pretty printed rendering of the current contents of the
--   <a>Config</a> to stdout.
displayConf :: Config -> IO ()

-- | Write the current contents of the given <a>Config</a> to the given
--   <a>FilePath</a>.
writeConf :: FilePath -> Config -> IO ()

-- | Render/pretty print the contents of a <a>HashMap</a> of keys and
--   <a>Value</a>s to a <a>String</a>.
renderHashMap :: HashMap Name Value -> String

-- | Convert the current contents of the given <a>Config</a> to a
--   <a>Doc</a> from the <i>pretty</i> package. This allows more
--   fine-grained control over printing it.
confDoc :: Config -> IO Doc

-- | Convert a <a>HashMap</a> of keys and <a>Value</a>s into a <a>Doc</a>,
--   from the <i>pretty</i> package. This allows more fine-grained control
--   over printing it.
--   
--   Expects keys to be in the format exported from a <a>Config</a> using
--   <a>getMap</a>. "foo.bar.baz.x" is "x" in group "baz" in group "bar" in
--   group "foo", etc.
hashMapDoc :: HashMap Name Value -> Doc

-- | Sensible defaults for a <a>ConfStyle</a>:
--   
--   <pre>
--   confStyle :: <a>ConfStyle</a>
--   confStyle = <a>ConfStyle</a> { confStyleIndent     = 4
--                         , confStyleAlign      = <a>AlignOn</a> 2
--                         , confStyleBraceStyle = <a>SameLineBrace</a>
--                         , confStyleBoolStyle  = <a>TrueFalse</a>
--                         , confStyleForceDec   = False
--                         , confStyleShowInts   = True
--                           -- sort by "type" of key, then sort alphabetically
--                         , confStyleSortBy     = <a>comparing</a> snd <a>&lt;&gt;</a> comparing fst
--                         , confStyleGroupSep   = 0
--                         , confStyleValueSep   = 0
--                         , confStyleTopSep     = 1
--                         }
--   </pre>
--   
--   It's recommended that you create <a>ConfStyle</a>s by modifying this
--   value using record syntax rather than create your own from scratch:
--   
--   <pre>
--   myStyle = <a>confStyle</a> { confStyleBraceStyle = <a>NewLineBrace</a>
--                       , confStyleBoolStyle  = <a>OnOff</a>
--                       }
--   </pre>
confStyle :: ConfStyle

-- | Style options for pretty-printing the contents of a <a>Config</a>.
--   Sensible defaults are given as <a>confStyle</a>; it's recommended that
--   you start with <a>confStyle</a> as a default and use record syntax to
--   modify it to what you want. See <a>confStyle</a> for more details.
data ConfStyle
ConfStyle :: Int -> AlignStyle -> BraceStyle -> BoolStyle -> Bool -> Bool -> ((Name, KeyType) -> (Name, KeyType) -> Ordering) -> Int -> Int -> Int -> ConfStyle

-- | Number of columns to indent each nested group.
[confStyleIndent] :: ConfStyle -> Int

-- | Style of aligning the equals signs for keys with values.
[confStyleAlign] :: ConfStyle -> AlignStyle

-- | Style of opening brace (curly bracket) placement.
[confStyleBraceStyle] :: ConfStyle -> BraceStyle

-- | Style of displaying <a>Bool</a>s as boolean literals.
[confStyleBoolStyle] :: ConfStyle -> BoolStyle

-- | Force full decimals to be rendered, instead of truncating to
--   scientific notation for numbers less than <tt>0.1</tt>.
[confStyleForceDec] :: ConfStyle -> Bool

-- | Whether or not to show "whole numbers" as integer literals (without
--   the trailing <tt>.0</tt>)
[confStyleShowInts] :: ConfStyle -> Bool

-- | Function to sort keys by, with information on whether or not the key
--   contains a group or a single value.
[confStyleSortBy] :: ConfStyle -> (Name, KeyType) -> (Name, KeyType) -> Ordering

-- | Newline seperators between groups.
[confStyleGroupSep] :: ConfStyle -> Int

-- | Newline seperators between chunks of contiguous values.
[confStyleValueSep] :: ConfStyle -> Int

-- | Newline seperators between groups and chunks of contiguous values at
--   the top level.
[confStyleTopSep] :: ConfStyle -> Int

-- | Alignment style of equals signs on contiguous sets of keys of values.
data AlignStyle

-- | Don't align equals signs at all.
NoAlign :: AlignStyle

-- | Align them to the longest key.
AlignAny :: AlignStyle

-- | Align to the longest key, but make sure the identation is a multiple
--   of this number.
AlignOn :: Int -> AlignStyle

-- | Placement style of opening braces (curly brackets) for groups.
data BraceStyle

-- | Opening braces go on the same line as the key name.
SameLineBrace :: BraceStyle

-- | Opening braces go on a new line after the key name.
NewLineBrace :: BraceStyle

-- | The style of boolean literals display <a>Bool</a>s as. Both are
--   accepted by configurator's parser.
data BoolStyle

-- | <tt>on</tt> and <tt>off</tt>
OnOff :: BoolStyle

-- | <tt>true</tt> and <tt>false</tt>
TrueFalse :: BoolStyle

-- | The type of structure that the key contains. Used for sorting.
data KeyType

-- | Key is associated with a group.
KeyGroup :: KeyType

-- | Key is associated with a single value.
KeyValue :: KeyType

-- | Render/pretty print the current contents of the given <a>Config</a> to
--   a <a>String</a>, providing a <a>ConfStyle</a> with the rendering
--   style.
renderConf' :: ConfStyle -> Config -> IO String

-- | Print out a pretty printed rendering of the current contents of the
--   <a>Config</a> to stdout, providing a <a>ConfStyle</a> with the
--   rendering style.
displayConf' :: ConfStyle -> Config -> IO ()

-- | Write the current contents of the given <a>Config</a> to the given
--   <a>FilePath</a>, providing a <a>ConfStyle</a> with the rendering
--   style.
writeConf' :: ConfStyle -> FilePath -> Config -> IO ()

-- | Render/pretty print the contents of a <a>HashMap</a> of keys and
--   <a>Value</a>s to a <a>String</a>, providing a <a>ConfStyle</a> with
--   the rendering style.
renderHashMap' :: ConfStyle -> HashMap Name Value -> String

-- | Convert the current contents of the given <a>Config</a> to a
--   <a>Doc</a> from the <i>pretty</i> package. This allows more
--   fine-grained control over printing it. Takes a <a>ConfStyle</a> with
--   the rendering style.
confDoc' :: ConfStyle -> Config -> IO Doc

-- | Convert a <a>HashMap</a> of keys and <a>Value</a>s into a <a>Doc</a>,
--   from the <i>pretty</i> package. This allows more fine-grained control
--   over printing it. Takes a <a>ConfStyle</a> with the rendering style.
--   
--   Expects keys to be in the format exported from a <a>Config</a> using
--   <a>getMap</a>. "foo.bar.baz.x" is "x" in group "baz" in group "bar" in
--   group "foo", etc.
hashMapDoc' :: ConfStyle -> HashMap Name Value -> Doc
instance GHC.Read.Read Data.Configurator.Export.BraceStyle
instance GHC.Classes.Ord Data.Configurator.Export.BraceStyle
instance GHC.Classes.Eq Data.Configurator.Export.BraceStyle
instance GHC.Show.Show Data.Configurator.Export.BraceStyle
instance GHC.Read.Read Data.Configurator.Export.AlignStyle
instance GHC.Classes.Ord Data.Configurator.Export.AlignStyle
instance GHC.Classes.Eq Data.Configurator.Export.AlignStyle
instance GHC.Show.Show Data.Configurator.Export.AlignStyle
instance GHC.Read.Read Data.Configurator.Export.BoolStyle
instance GHC.Classes.Ord Data.Configurator.Export.BoolStyle
instance GHC.Classes.Eq Data.Configurator.Export.BoolStyle
instance GHC.Show.Show Data.Configurator.Export.BoolStyle
instance GHC.Read.Read Data.Configurator.Export.KeyType
instance GHC.Classes.Ord Data.Configurator.Export.KeyType
instance GHC.Classes.Eq Data.Configurator.Export.KeyType
instance GHC.Show.Show Data.Configurator.Export.KeyType
instance (GHC.Classes.Eq v, GHC.Classes.Eq k) => GHC.Classes.Eq (Data.Configurator.Export.HashMapTree k v)
instance (GHC.Show.Show v, GHC.Show.Show k) => GHC.Show.Show (Data.Configurator.Export.HashMapTree k v)
