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

-- | A library for simple INI-based configuration files.
--   
--   The config-ini library is a set of small monadic languages
--   for writing simple configuration languages with convenient,
--   human-readable error messages.
--   
--   
--   parseConfig :: IniParser (Text, Int, Bool)
--   parseConfig = section "NETWORK" $ do
--     user <- field        "user"
--     port <- fieldOf      "port" number
--     enc  <- fieldFlagDef "encryption" True
--     return (user, port, enc)
--   
@package config-ini
@version 0.2.7.0

-- | Warning! This module is subject to change in the future, and
--   therefore should not be relied upon to have a consistent API.
module Data.Ini.Config.Raw

-- | An Ini value is a mapping from section names to
--   IniSection values. The section names in this mapping are
--   normalized to lower-case and stripped of whitespace. This sequence
--   retains the ordering of the original source file.
newtype RawIni
RawIni :: Seq (NormalizedText, IniSection) -> RawIni
[fromRawIni] :: RawIni -> Seq (NormalizedText, IniSection)

-- | An IniSection consists of a name, a mapping of key-value pairs,
--   and metadata about where the section starts and ends in the file. The
--   section names found in isName are not normalized to
--   lower-case or stripped of whitespace, and thus should appear exactly
--   as they appear in the original source file.
data IniSection
IniSection :: Text -> Seq (NormalizedText, IniValue) -> Int -> Int -> Seq BlankLine -> IniSection

-- | The name of the section, as it appears in the original INI source
[isName] :: IniSection -> Text

-- | The key-value mapping within that section. Key names here are
--   normalized to lower-case and stripped of whitespace. This sequence
--   retains the ordering of the original source file.
[isVals] :: IniSection -> Seq (NormalizedText, IniValue)

-- | The line on which the section begins. This field is ignored when
--   serializing, and is only used for error messages produced when parsing
--   and deserializing an INI structure.
[isStartLine] :: IniSection -> Int

-- | The line on which the section ends. This field is ignored when
--   serializing, and is only used for error messages produced when parsing
--   and deserializing an INI structure.
[isEndLine] :: IniSection -> Int

-- | The blank lines and comments that appear prior to the section head
--   declaration, retained for pretty-printing identical INI files.
[isComments] :: IniSection -> Seq BlankLine

-- | An IniValue represents a key-value mapping, and also stores the
--   line number where it appears. The key names and values found in
--   vName and vValue respectively are _not_ normalized to
--   lower-case or stripped of whitespace, and thus should appear exactly
--   as they appear in the original source file.
data IniValue
IniValue :: Int -> Text -> Text -> Seq BlankLine -> Bool -> Char -> IniValue

-- | The line on which the key/value mapping appears. This field is ignored
--   when serializing, and is only used for error messages produced when
--   parsing and deserializing an INI structure.
[vLineNo] :: IniValue -> Int

-- | The name of the key, as it appears in the INI source.
[vName] :: IniValue -> Text

-- | The value of the key
[vValue] :: IniValue -> Text
[vComments] :: IniValue -> Seq BlankLine

-- | Right now, this will never show up in a parsed INI file, but it's used
--   when emitting a default INI file: it causes the key-value line to
--   include a leading comment as well.
[vCommentedOut] :: IniValue -> Bool
[vDelimiter] :: IniValue -> Char

-- | We want to keep track of the whitespace/comments in between KV lines,
--   so this allows us to track those lines in a reproducible way.
data BlankLine
CommentLine :: Char -> Text -> BlankLine
BlankLine :: BlankLine

-- | The NormalizedText type is an abstract representation of text
--   which has had leading and trailing whitespace removed and been
--   normalized to lower-case, but from which we can still extract the
--   original, non-normalized version. This acts like the normalized text
--   for the purposes of Eq and Ord operations, so
--   
--   
--   normalize "  x  " == normalize "X"
--   
--   
--   This type is used to store section and key names in the
data NormalizedText
NormalizedText :: Text -> Text -> NormalizedText
[actualText] :: NormalizedText -> Text
[normalizedText] :: NormalizedText -> Text

-- | The constructor function to build a NormalizedText value. You
--   probably shouldn't be using this module directly, but if for some
--   reason you are using it, then you should be using this function to
--   create NormalizedText values.
normalize :: Text -> NormalizedText

-- | Parse a Text value into an Ini value, retaining a
--   maximal amount of structure as needed to reconstruct the original INI
--   file.
parseRawIni :: Text -> Either String RawIni

-- | Serialize an INI file to text, complete with any comments which appear
--   in the INI structure, and retaining the aesthetic details which are
--   present in the INI file.
printRawIni :: RawIni -> Text

-- | Look up an Ini value by section name and key. Returns the sequence of
--   matches.
lookupInSection :: Text -> Text -> RawIni -> Seq Text

-- | Look up an Ini section by name. Returns a sequence of all matching
--   section records.
lookupSection :: Text -> RawIni -> Seq IniSection

-- | Look up an Ini key's value in a given section by the key. Returns the
--   sequence of matches.
lookupValue :: Text -> IniSection -> Seq IniValue
instance GHC.Classes.Eq Data.Ini.Config.Raw.BlankLine
instance GHC.Classes.Eq Data.Ini.Config.Raw.IniSection
instance GHC.Classes.Eq Data.Ini.Config.Raw.IniValue
instance GHC.Classes.Eq Data.Ini.Config.Raw.NormalizedText
instance GHC.Classes.Eq Data.Ini.Config.Raw.RawIni
instance GHC.Classes.Ord Data.Ini.Config.Raw.NormalizedText
instance GHC.Internal.Show.Show Data.Ini.Config.Raw.BlankLine
instance GHC.Internal.Show.Show Data.Ini.Config.Raw.IniSection
instance GHC.Internal.Show.Show Data.Ini.Config.Raw.IniValue
instance GHC.Internal.Show.Show Data.Ini.Config.Raw.NormalizedText
instance GHC.Internal.Show.Show Data.Ini.Config.Raw.RawIni

-- | This module presents an alternate API for parsing INI files. Unlike
--   the standard API, it is bidirectional: the same declarative structure
--   can be used to parse an INI file to a value, serialize an INI file
--   from a value, or even update an INI file by comparing it
--   against a value and serializing in a way that minimizes the
--   differences between revisions of the file.
--   
--   This API does make some extra assumptions about your configuration
--   type and the way you interact with it: in particular, it assumes that
--   you have lenses for all the fields you're parsing and that you have
--   some kind of sensible default value of that configuration type.
--   Instead of providing combinators which can extract and parse a field
--   of an INI file into a value, the bidirectional API allows you to
--   declaratively associate a lens into your structure with a field of the
--   INI file.
--   
--   Consider the following example INI file:
--   
--   
--   [NETWORK]
--   host = example.com
--   port = 7878
--   
--   [LOCAL]
--   user = terry
--   
--   
--   We'd like to parse this INI file into a Config type which
--   we've defined like this, using lens or a similar library to
--   provide lenses:
--   
--   
--   data Config = Config
--     { _cfHost :: String
--     , _cfPort :: Int
--     , _cfUser :: Maybe Text
--     } deriving (Eq, Show)
--   
--   ''makeLenses Config
--   
--   
--   We can now define a basic specification of the type IniSpec
--   Config () by using the provided operations to declare our
--   top-level sections, and then within those sections we can associate
--   fields with Config lenses.
--   
--   
--   configSpec :: IniSpec Config ()
--   configSpec = do
--     section "NETWORK" $ do
--       cfHost .= field "host" string
--       cfPost .= field "port" number
--     sectionOpt "LOCAL" $ do
--       cfUser .=? field "user" text
--   
--   
--   There are two operators used to associate lenses with fields:
--   
--   
--   
- .= Associates a lens of type Lens' s a with
--   a field description of type FieldDescription a. By default,
--   this will raise an error when parsing if the field described is
--   missing, but we can mark it as optional, as we'll see.
--   
- .=? Associates a lens of type Lens' s (Maybe
--   a) with a field description of type FieldDescription a.
--   During parsing, if the value does not appear in an INI file, then the
--   lens will be set to Nothing; similarly, during serializing, if
--   the value is Nothing, then the field will not be serialized in
--   the file.
--   
--   
--   Each field must include the field's name as well as a
--   FieldValue, which describes how to both parse and serialize a
--   value of a given type. Several built-in FieldValue descriptions
--   are provided, but you can always build your own by providing parsing
--   and serialization functions for individual fields.
--   
--   We can also provide extra metadata about a field, allowing it to be
--   skipped durin parsing, or to provide an explicit default value, or to
--   include an explanatory comment for that value to be used when we
--   serialize an INI file. These are conventionally applied to the field
--   using the & operator:
--   
--   
--   configSpec :: IniSpec Config ()
--   configSpec = do
--     section "NETWORK" $ do
--       cfHost .= field "host" string
--                   & comment ["The desired hostname (optional)"]
--                   & optional
--       cfPost .= field "port" number
--                   & comment ["The port number"]
--     sectionOpt "LOCAL" $ do
--       cfUser .=? field "user" text
--   
--   
--   When we want to use this specification, we need to create a value of
--   type Ini, which is an abstract representation of an INI
--   specification. To create an Ini value, we need to use the
--   ini function, which combines the spec with the default version
--   of our configuration value.
--   
--   Once we have a value of type Ini, we can use it for three basic
--   operations:
--   
--   
--   
- We can parse a textual INI file with parseIni, which will
--   systematically walk the spec and use the provided lens/field
--   associations to create a parsed configuration file. This will give us
--   a new value of type Ini that represents the parsed
--   configuration, and we can extract the actual configuration value with
--   getIniValue.
--   
- We can update the value contained in an Ini value. If the
--   Ini value is the result of a previous call to parseIni,
--   then this update will attempt to retain as much of the incidental
--   structure of the parsed file as it can: for example, it will attempt
--   to retain comments, whitespace, and ordering. The general strategy is
--   to make the resulting INI file "diff-minimal": the diff between the
--   older INI file and the updated INI file should contain as little noise
--   as possible. Small cosmetic choices such as how to treat generated
--   comments are controlled by a configurable UpdatePolicy
--   value.
--   
- We can serialize an Ini value to a textual INI file. This
--   will produce the specified INI file (either a default fresh INI, or a
--   modified existing INI) as a textual value.
--   
module Data.Ini.Config.Bidir

-- | An Ini is an abstract representation of an INI file, including
--   both its textual representation and the Haskell value it represents.
data Ini s

-- | Create a basic Ini value from a default value and a spec.
ini :: s -> IniSpec s () -> Ini s

-- | Get the underlying Haskell value associated with the Ini.
getIniValue :: Ini s -> s

-- | The lens equivalent of getIniValue
iniValueL :: forall s f. Functor f => (s -> f s) -> Ini s -> f (Ini s)

-- | Get the underlying RawIni value for the file.
getRawIni :: Ini s -> RawIni

-- | Parse a textual representation of an Ini file. If the file is
--   malformed or if an obligatory field is not found, this will produce a
--   human-readable error message. If an optional field is not found, then
--   it will fall back on the existing value contained in the provided
--   Ini structure.
parseIni :: Text -> Ini s -> Either String (Ini s)

-- | Get the textual representation of an Ini value. If this
--   Ini value is the result of parseIni, then it will
--   attempt to retain the textual characteristics of the parsed version as
--   much as possible (e.g. by retaining comments, ordering, and whitespace
--   in a way that will minimize the overall diff footprint.) If the
--   Ini value was created directly from a value and a
--   specification, then it will pretty-print an initial version of the
--   file with the comments and placeholder text specified in the spec.
serializeIni :: Ini s -> Text

-- | Update the internal value of an Ini file. If this Ini
--   value is the result of parseIni, then the resulting Ini
--   value will attempt to retain the textual characteristics of the parsed
--   version as much as possible (e.g. by retaining comments, ordering, and
--   whitespace in a way that will minimize the overall diff footprint.)
updateIni :: s -> Ini s -> Ini s

-- | Use the provided UpdatePolicy as a guide when creating future
--   updated versions of the given Ini value.
setIniUpdatePolicy :: UpdatePolicy -> Ini s -> Ini s

-- | An UpdatePolicy guides certain choices made when an Ini
--   file is updated: for example, how to add comments to the generated
--   fields, or how to treat fields which are optional.
data UpdatePolicy
UpdatePolicy :: Bool -> Bool -> UpdateCommentPolicy -> UpdatePolicy

-- | If True, then optional fields not included in the INI file will
--   be included in the updated INI file. Defaults to False.
[updateAddOptionalFields] :: UpdatePolicy -> Bool

-- | If True, then fields in the INI file that have no corresponding
--   description in the IniSpec will be ignored; if False,
--   then those fields will return an error value. Defaults to True.
[updateIgnoreExtraneousFields] :: UpdatePolicy -> Bool

-- | The policy for what to do to comments associated with modified fields
--   during an update. Defaults to CommentPolicyNone.
[updateGeneratedCommentPolicy] :: UpdatePolicy -> UpdateCommentPolicy

-- | An UpdateCommentPolicy describes what comments should accompany
--   a field added to or modified in an existing INI file when using
--   updateIni.
data UpdateCommentPolicy

-- | Do not add comments to new fields
CommentPolicyNone :: UpdateCommentPolicy

-- | Add the same comment which appears in the IniSpec value for the
--   field we're adding or modifying.
CommentPolicyAddFieldComment :: UpdateCommentPolicy

-- | Add a common comment to all new fields added or modified by an
--   updateIni call.
CommentPolicyAddDefaultComment :: Seq Text -> UpdateCommentPolicy

-- | A set of sensible UpdatePolicy defaults which keep the diffs
--   between file versions minimal.
defaultUpdatePolicy :: UpdatePolicy

-- | An IniSpec value represents the structure of an entire
--   INI-format file in a declarative way. The s parameter
--   represents the type of a Haskell structure which is being serialized
--   to or from.
data IniSpec s a

-- | A SectionSpec value represents the structure of a single
--   section of an INI-format file in a declarative way. The s
--   parameter represents the type of a Haskell structure which is being
--   serialized to or from.
data SectionSpec s a

-- | Define the specification of a top-level INI section.
section :: Text -> SectionSpec s () -> IniSpec s ()

-- | Treat an entire section as containing entirely optional fields.
allOptional :: (SectionSpec s () -> IniSpec s ()) -> SectionSpec s () -> IniSpec s ()

-- | A FieldDescription is a declarative representation of the
--   structure of a field. This includes the name of the field and the
--   FieldValue used to parse and serialize values of that field, as
--   well as other metadata that might be needed in the course of parsing
--   or serializing a structure.
data FieldDescription t

-- | Associate a field description with a field. If this field is not
--   present when parsing, it will attempt to fall back on a default, and
--   if no default value is present, it will fail to parse.
--   
--   When serializing an INI file, this will produce all the comments
--   associated with the field description followed by the value of the
--   field in the.
(.=) :: Eq t => Lens s s t t -> FieldDescription t -> SectionSpec s ()
infixr 0 .=

-- | Associate a field description with a field of type "Maybe a". When
--   parsing, this field will be initialized to Nothing if it is not
--   found, and to a Just value if it is. When serializing an INI
--   file, this will try to serialize a value
(.=?) :: Eq t => Lens s s (Maybe t) (Maybe t) -> FieldDescription t -> SectionSpec s ()
infixr 0 .=?

-- | Create a description of a field by a combination of the name of the
--   field and a FieldValue describing how to parse and emit values
--   associated with that field.
field :: Text -> FieldValue a -> FieldDescription a

-- | Create a description of a Bool-valued field.
flag :: Text -> FieldDescription Bool

-- | Associate a multiline comment with a FieldDescription. When
--   serializing a field that has a comment associated, the comment will
--   appear before the field.
comment :: [Text] -> FieldDescription t -> FieldDescription t

-- | Choose a placeholder value to be displayed for optional fields. This
--   is used when serializing an optional Ini field: the field will appear
--   commented out in the output using the placeholder text as a value, so
--   a spec that includes
--   
--   
--   myLens .=? field "x" & placeholderValue "<val>"
--   
--   
--   
--   will serialize into an INI file that contains the line
--   
--   
--   # x = <val>
--   
--   
--   
--   A placeholder value will only appear in the serialized output if the
--   field is optional, but will be preferred over serializing the default
--   value for an optional field. This will not affect INI file updates.
placeholderValue :: Text -> FieldDescription t -> FieldDescription t

-- | If the field is not found in parsing, simply skip instead of raising
--   an error or setting anything.
optional :: FieldDescription t -> FieldDescription t

-- | A value of type FieldValue packages up a parser and emitter
--   function into a single value. These are used for bidirectional parsing
--   and emitting of the value of a field.
data FieldValue a
FieldValue :: (Text -> Either String a) -> (a -> Text) -> FieldValue a

-- | The function to use when parsing the value of a field; if the parser
--   fails, then the string will be shown as an error message to the user.
[fvParse] :: FieldValue a -> Text -> Either String a

-- | The function to use when serializing a value into an INI file.
[fvEmit] :: FieldValue a -> a -> Text

-- | Represents a field whose value is a Text value
text :: FieldValue Text

-- | Represents a field whose value is a String value
string :: FieldValue String

-- | Represents a numeric field whose value is parsed according to the
--   Read implementation for that type, and is serialized according
--   to the Show implementation for that type.
number :: (Show a, Read a, Num a, Typeable a) => FieldValue a

-- | Represents a field whose value is a Bool value. This parser is
--   case-insensitive, and matches the words true, false,
--   yes, and no, as well as single-letter abbreviations
--   for all of the above. This will serialize as true for
--   True and false for False.
bool :: FieldValue Bool

-- | A FieldValue for parsing and serializing values according to
--   the logic of the Read and Show instances for that type,
--   providing a convenient human-readable error message if the parsing
--   step fails.
readable :: (Show a, Read a, Typeable a) => FieldValue a

-- | Represents a field whose value is a sequence of other values which are
--   delimited by a given string, and whose individual values are described
--   by another FieldValue value. This uses GHC's IsList
--   typeclass to convert back and forth between sequence types.
listWithSeparator :: IsList l => Text -> FieldValue (Item l) -> FieldValue l

-- | Represents a field whose value is a pair of two other values separated
--   by a given string, whose individual values are described by two
--   different FieldValue values.
pairWithSeparator :: FieldValue l -> Text -> FieldValue r -> FieldValue (l, r)

-- | & is a reverse application operator. This provides
--   notational convenience. Its precedence is one higher than that of the
--   forward application operator $, which allows & to be
--   nested in $.
--   
--   This is a version of flip id, where id
--   is specialized from a -> a to (a -> b) -> (a
--   -> b) which by the associativity of (->) is (a
--   -> b) -> a -> b. flipping this yields a -> (a
--   -> b) -> b which is the type signature of &
--   
--   
Examples
--   
--   
--   >>> 5 & (+1) & show
--   "6"
--   
--   
--   
--   >>> sqrt $ [1 / n^2 | n <- [1..1000]] & sum & (*6)
--   3.1406380562059946
--   
(&) :: a -> (a -> b) -> b
infixl 1 &

-- | This is a lens-compatible type alias
type Lens s t a b = forall (f :: Type -> Type). Functor f => a -> f b -> s -> f t
instance GHC.Internal.Base.Applicative (Data.Ini.Config.Bidir.IniSpec s)
instance GHC.Internal.Base.Applicative (Data.Ini.Config.Bidir.SectionSpec s)
instance GHC.Classes.Eq Data.Ini.Config.Bidir.UpdateCommentPolicy
instance GHC.Classes.Eq Data.Ini.Config.Bidir.UpdatePolicy
instance GHC.Internal.Base.Functor (Data.Ini.Config.Bidir.C a)
instance GHC.Internal.Base.Functor Data.Ini.Config.Bidir.I
instance GHC.Internal.Base.Functor (Data.Ini.Config.Bidir.IniSpec s)
instance GHC.Internal.Base.Functor (Data.Ini.Config.Bidir.SectionSpec s)
instance GHC.Internal.Base.Monad (Data.Ini.Config.Bidir.IniSpec s)
instance GHC.Internal.Base.Monad (Data.Ini.Config.Bidir.SectionSpec s)
instance GHC.Internal.Show.Show Data.Ini.Config.Bidir.UpdateCommentPolicy
instance GHC.Internal.Show.Show Data.Ini.Config.Bidir.UpdatePolicy

-- | The 'config-ini' library exports some simple monadic functions to make
--   parsing INI-like configuration easier. INI files have a two-level
--   structure: the top-level named chunks of configuration, and the
--   individual key-value pairs contained within those chunks. For example,
--   the following INI file has two sections, NETWORK and
--   LOCAL, and each contains its own key-value pairs. Comments,
--   which begin with # or ;, are ignored:
--   
--   
--   [NETWORK]
--   host = example.com
--   port = 7878
--   
--   # here is a comment
--   [LOCAL]
--   user = terry
--   
--   
--   The combinators provided here are designed to write quick and
--   idiomatic parsers for files of this form. Sections are parsed by
--   IniParser computations, like section and its variations,
--   while the fields within sections are parsed by SectionParser
--   computations, like field and its variations. If we want to
--   parse an INI file like the one above, treating the entire
--   LOCAL section as optional, we can write it like this:
--   
--   
--   data Config = Config
--     { cfNetwork :: NetworkConfig, cfLocal :: Maybe LocalConfig }
--       deriving (Eq, Show)
--   
--   data NetworkConfig = NetworkConfig
--     { netHost :: String, netPort :: Int }
--       deriving (Eq, Show)
--   
--   data LocalConfig = LocalConfig
--     { localUser :: Text }
--       deriving (Eq, Show)
--   
--   configParser :: IniParser Config
--   configParser = do
--     netCf <- section "NETWORK" $ do
--       host <- fieldOf "host" string
--       port <- fieldOf "port" number
--       return NetworkConfig { netHost = host, netPort = port }
--     locCf <- sectionMb "LOCAL" $
--       LocalConfig <$> field "user"
--     return Config { cfNetwork = netCf, cfLocal = locCf }
--   
--   
--   We can run our computation with parseIniFile, which, when run
--   on our example file above, would produce the following:
--   
--   
--   >>> parseIniFile example configParser
--   Right (Config {cfNetwork = NetworkConfig {netHost = "example.com", netPort = 7878}, cfLocal = Just (LocalConfig {localUser = "terry"})})
--   
module Data.Ini.Config

-- | Parse a Text value as an INI file and run an IniParser
--   over it
parseIniFile :: Text -> IniParser a -> Either String a

-- | An IniParser value represents a computation for parsing entire
--   INI-format files.
data IniParser a

-- | A SectionParser value represents a computation for parsing a
--   single section of an INI-format file.
data SectionParser a

-- | Find a named section in the INI file and parse it with the provided
--   section parser, failing if the section does not exist. In order to
--   support classic INI files with capitalized section names, section
--   lookup is case-insensitive.
--   
--   
--   >>> parseIniFile "[ONE]\nx = hello\n" $ section "ONE" (field "x")
--   Right "hello"
--   
--   >>> parseIniFile "[ONE]\nx = hello\n" $ section "TWO" (field "x")
--   Left "No top-level section named \"TWO\""
--   
section :: Text -> SectionParser a -> IniParser a

-- | Find multiple named sections in the INI file and parse them all with
--   the provided section parser. In order to support classic INI files
--   with capitalized section names, section lookup is
--   case-insensitive.
--   
--   
--   >>> parseIniFile "[ONE]\nx = hello\n[ONE]\nx = goodbye\n" $ sections "ONE" (field "x")
--   Right (fromList ["hello","goodbye"])
--   
--   >>> parseIniFile "[ONE]\nx = hello\n" $ sections "TWO" (field "x")
--   Right (fromList [])
--   
sections :: Text -> SectionParser a -> IniParser (Seq a)

-- | A call to sectionOf f will apply f to each section
--   name and, if f produces a Just value, pass the
--   extracted value in order to get the SectionParser to use for
--   that section. This will find at most one section, and will produce an
--   error if no section exists.
--   
--   
--   >>> parseIniFile "[FOO]\nx = hello\n" $ sectionOf (T.stripSuffix "OO") (\ l -> fmap ((,) l) (field "x"))
--   Right ("F","hello")
--   
--   >>> parseIniFile "[BAR]\nx = hello\n" $ sectionOf (T.stripSuffix "OO") (\ l -> fmap ((,) l) (field "x"))
--   Left "No matching top-level section"
--   
sectionOf :: (Text -> Maybe b) -> (b -> SectionParser a) -> IniParser a

-- | A call to sectionsOf f will apply f to each section
--   name and, if f produces a Just value, pass the
--   extracted value in order to get the SectionParser to use for
--   that section. This will return every section for which the call to
--   f produces a Just value.
--   
--   
--   >>> parseIniFile "[FOO]\nx = hello\n[BOO]\nx = goodbye\n" $ sectionsOf (T.stripSuffix "OO") (\ l -> fmap ((,) l) (field "x"))
--   Right (fromList [("F","hello"),("B","goodbye")])
--   
--   >>> parseIniFile "[BAR]\nx = hello\n" $ sectionsOf (T.stripSuffix "OO") (\ l -> fmap ((,) l) (field "x"))
--   Right (fromList [])
--   
sectionsOf :: (Text -> Maybe b) -> (b -> SectionParser a) -> IniParser (Seq a)

-- | Find a named section in the INI file and parse it with the provided
--   section parser, returning Nothing if the section does not
--   exist. In order to support classic INI files with capitalized section
--   names, section lookup is case-insensitive.
--   
--   
--   >>> parseIniFile "[ONE]\nx = hello\n" $ sectionMb "ONE" (field "x")
--   Right (Just "hello")
--   
--   >>> parseIniFile "[ONE]\nx = hello\n" $ sectionMb "TWO" (field "x")
--   Right Nothing
--   
sectionMb :: Text -> SectionParser a -> IniParser (Maybe a)

-- | Find a named section in the INI file and parse it with the provided
--   section parser, returning a default value if the section does not
--   exist. In order to support classic INI files with capitalized section
--   names, section lookup is case-insensitive.
--   
--   
--   >>> parseIniFile "[ONE]\nx = hello\n" $ sectionDef "ONE" "def" (field "x")
--   Right "hello"
--   
--   >>> parseIniFile "[ONE]\nx = hello\n" $ sectionDef "TWO" "def" (field "x")
--   Right "def"
--   
sectionDef :: Text -> a -> SectionParser a -> IniParser a

-- | Retrieve a field, failing if it doesn't exist, and return its raw
--   value.
--   
--   
--   >>> parseIniFile "[MAIN]\nx = hello\n" $ section "MAIN" (field "x")
--   Right "hello"
--   
--   >>> parseIniFile "[MAIN]\nx = hello\n" $ section "MAIN" (field "y")
--   Left "Missing field \"y\" in section \"MAIN\""
--   
field :: Text -> SectionParser Text

-- | Retrieve a field and use the supplied parser to parse it as a value,
--   failing if the field does not exist, or if the parser fails to produce
--   a value.
--   
--   
--   >>> parseIniFile "[MAIN]\nx = 72\n" $ section "MAIN" (fieldOf "x" number)
--   Right 72
--   
--   >>> parseIniFile "[MAIN]\nx = hello\n" $ section "MAIN" (fieldOf "x" number)
--   Left "Line 2, in section \"MAIN\": Unable to parse \"hello\" as a value of type Integer"
--   
--   >>> parseIniFile "[MAIN]\nx = 72\n" $ section "MAIN" (fieldOf "y" number)
--   Left "Missing field \"y\" in section \"MAIN\""
--   
fieldOf :: Text -> (Text -> Either String a) -> SectionParser a

-- | Retrieve a field, returning a Nothing value if it does not
--   exist.
--   
--   
--   >>> parseIniFile "[MAIN]\nx = hello\n" $ section "MAIN" (fieldMb "x")
--   Right (Just "hello")
--   
--   >>> parseIniFile "[MAIN]\nx = hello\n" $ section "MAIN" (fieldMb "y")
--   Right Nothing
--   
fieldMb :: Text -> SectionParser (Maybe Text)

-- | Retrieve a field and parse it according to the given parser, returning
--   Nothing if it does not exist. If the parser fails, then this
--   will fail.
--   
--   
--   >>> parseIniFile "[MAIN]\nx = 72\n" $ section "MAIN" (fieldMbOf "x" number)
--   Right (Just 72)
--   
--   >>> parseIniFile "[MAIN]\nx = hello\n" $ section "MAIN" (fieldMbOf "x" number)
--   Left "Line 2, in section \"MAIN\": Unable to parse \"hello\" as a value of type Integer"
--   
--   >>> parseIniFile "[MAIN]\nx = 72\n" $ section "MAIN" (fieldMbOf "y" number)
--   Right Nothing
--   
fieldMbOf :: Text -> (Text -> Either String a) -> SectionParser (Maybe a)

-- | Retrieve a field and supply a default value for if it doesn't exist.
--   
--   
--   >>> parseIniFile "[MAIN]\nx = hello\n" $ section "MAIN" (fieldDef "x" "def")
--   Right "hello"
--   
--   >>> parseIniFile "[MAIN]\nx = hello\n" $ section "MAIN" (fieldDef "y" "def")
--   Right "def"
--   
fieldDef :: Text -> Text -> SectionParser Text

-- | Retrieve a field, parsing it according to the given parser, and
--   returning a default value if it does not exist. If the parser fails,
--   then this will fail.
--   
--   
--   >>> parseIniFile "[MAIN]\nx = 72\n" $ section "MAIN" (fieldDefOf "x" number 99)
--   Right 72
--   
--   >>> parseIniFile "[MAIN]\nx = hello\n" $ section "MAIN" (fieldDefOf "x" number 99)
--   Left "Line 2, in section \"MAIN\": Unable to parse \"hello\" as a value of type Integer"
--   
--   >>> parseIniFile "[MAIN]\nx = 72\n" $ section "MAIN" (fieldDefOf "y" number 99)
--   Right 99
--   
fieldDefOf :: Text -> (Text -> Either String a) -> a -> SectionParser a

-- | Retrieve a field and treat it as a boolean, failing if it does not
--   exist.
--   
--   
--   >>> parseIniFile "[MAIN]\nx = yes\n" $ section "MAIN" (fieldFlag "x")
--   Right True
--   
--   >>> parseIniFile "[MAIN]\nx = yes\n" $ section "MAIN" (fieldFlag "y")
--   Left "Missing field \"y\" in section \"MAIN\""
--   
fieldFlag :: Text -> SectionParser Bool

-- | Retrieve a field and treat it as a boolean, subsituting a default
--   value if it doesn't exist.
--   
--   
--   >>> parseIniFile "[MAIN]\nx = yes\n" $ section "MAIN" (fieldFlagDef "x" False)
--   Right True
--   
--   >>> parseIniFile "[MAIN]\nx = hello\n" $ section "MAIN" (fieldFlagDef "x" False)
--   Left "Line 2, in section \"MAIN\": Unable to parse \"hello\" as a boolean"
--   
--   >>> parseIniFile "[MAIN]\nx = yes\n" $ section "MAIN" (fieldFlagDef "y" False)
--   Right False
--   
fieldFlagDef :: Text -> Bool -> SectionParser Bool

-- | Try to use the Read instance for a type to parse a value,
--   failing with a human-readable error message if reading fails.
--   
--   
--   >>> readable "(5, 7)" :: Either String (Int, Int)
--   Right (5,7)
--   
--   >>> readable "hello" :: Either String (Int, Int)
--   Left "Unable to parse \"hello\" as a value of type (Int,Int)"
--   
readable :: (Read a, Typeable a) => Text -> Either String a

-- | Try to use the Read instance for a numeric type to parse a
--   value, failing with a human-readable error message if reading fails.
--   
--   
--   >>> number "5" :: Either String Int
--   Right 5
--   
--   >>> number "hello" :: Either String Int
--   Left "Unable to parse \"hello\" as a value of type Int"
--   
number :: (Num a, Read a, Typeable a) => Text -> Either String a

-- | Convert a textual value to the appropriate string type. This will
--   never fail.
--   
--   
--   >>> string "foo" :: Either String String
--   Right "foo"
--   
string :: IsString a => Text -> Either String a

-- | Convert a string that represents a boolean to a proper boolean. This
--   is case-insensitive, and matches the words true,
--   false, yes, no, as well as single-letter
--   abbreviations for all of the above. If the input does not match, then
--   this will fail with a human-readable error message.
--   
--   
--   >>> flag "TRUE"
--   Right True
--   
--   >>> flag "y"
--   Right True
--   
--   >>> flag "no"
--   Right False
--   
--   >>> flag "F"
--   Right False
--   
--   >>> flag "That's a secret!"
--   Left "Unable to parse \"That's a secret!\" as a boolean"
--   
flag :: Text -> Either String Bool

-- | Convert a reader for a value into a reader for a list of those values,
--   separated by a chosen separator. This will split apart the string on
--   that separator, get rid of leading and trailing whitespace on the
--   individual chunks, and then attempt to parse each of them according to
--   the function provided, turning the result into a list.
--   
--   This is overloaded with the IsList typeclass, so it can be used
--   transparently to parse other list-like types.
--   
--   
--   >>> listWithSeparator "," number "2, 3, 4" :: Either String [Int]
--   Right [2,3,4]
--   
--   >>> listWithSeparator " " number "7 8 9" :: Either String [Int]
--   Right [7,8,9]
--   
--   >>> listWithSeparator ":" string "/bin:/usr/bin" :: Either String [FilePath]
--   Right ["/bin","/usr/bin"]
--   
--   >>> listWithSeparator "," number "7 8 9" :: Either String [Int]
--   Left "Unable to parse \"7 8 9\" as a value of type Int"
--   
listWithSeparator :: IsList l => Text -> (Text -> Either String (Item l)) -> Text -> Either String l
instance GHC.Internal.Base.Alternative Data.Ini.Config.IniParser
instance GHC.Internal.Base.Alternative Data.Ini.Config.SectionParser
instance GHC.Internal.Base.Applicative Data.Ini.Config.IniParser
instance GHC.Internal.Base.Applicative Data.Ini.Config.SectionParser
instance GHC.Internal.Base.Functor Data.Ini.Config.IniParser
instance GHC.Internal.Base.Functor Data.Ini.Config.SectionParser
instance GHC.Internal.Base.Monad Data.Ini.Config.IniParser
instance GHC.Internal.Base.Monad Data.Ini.Config.SectionParser
