HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleconfig-ini-0.2.7.0Haskell2010

Data.Ini.Config.Raw

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

  • 5 types
  • 6 values

INI types

6 declarations
newtypenewtype RawIni
#

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.

Instances2Eq, Show
  • Eq RawIniDefined in config-ini-0.2.7.0 · Data.Ini.Config.Raw
  • Show RawIniDefined in config-ini-0.2.7.0 · Data.Ini.Config.Raw
datadata 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.

Constructors

  • IniSection
    • isName :: Text

      The name of the section, as it appears in the original INI source

    • isVals :: Seq (NormalizedText, IniValue)

      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.

    • isStartLine :: Int

      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.

    • isEndLine :: 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.

    • isComments :: Seq BlankLine

      The blank lines and comments that appear prior to the section head declaration, retained for pretty-printing identical INI files.

Instances2Eq, Show
  • Eq IniSectionDefined in config-ini-0.2.7.0 · Data.Ini.Config.Raw
  • Show IniSectionDefined in config-ini-0.2.7.0 · Data.Ini.Config.Raw
datadata IniValue
#

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.

Constructors

  • IniValue
    • vLineNo :: Int

      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.

    • vName :: Text

      The name of the key, as it appears in the INI source.

    • vValue :: Text

      The value of the key

    • vComments :: Seq BlankLine
    • vCommentedOut :: Bool

      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.

    • vDelimiter :: Char
Instances2Eq, Show
  • Eq IniValueDefined in config-ini-0.2.7.0 · Data.Ini.Config.Raw
  • Show IniValueDefined in config-ini-0.2.7.0 · Data.Ini.Config.Raw
datadata BlankLine
#

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.

Instances2Eq, Show
  • Eq BlankLineDefined in config-ini-0.2.7.0 · Data.Ini.Config.Raw
  • Show BlankLineDefined in config-ini-0.2.7.0 · Data.Ini.Config.Raw
datadata NormalizedText
#

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

Instances3Eq, Ord, Show

serializing and deserializing

2 declarations
valueprintRawIni :: RawIni -> Text
#

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.

inspection

3 declarations
valuelookupInSection
  1. :: Text

    The section name. Will be normalized prior to comparison.

  2. -> Text

    The key. Will be normalized prior to comparison.

  3. -> RawIni

    The Ini to search.

  4. -> Seq Text
#

Look up an Ini value by section name and key. Returns the sequence of matches.

valuelookupSection
  1. :: Text

    The section name. Will be normalized prior to comparison.

  2. -> RawIni

    The Ini to search.

  3. -> Seq IniSection
#

Look up an Ini section by name. Returns a sequence of all matching section records.

valuelookupValue
  1. :: Text

    The key. Will be normalized prior to comparison.

  2. -> IniSection

    The section to search.

  3. -> Seq IniValue
#

Look up an Ini key's value in a given section by the key. Returns the sequence of matches.