polar-configfile-0.2.0.1: Fork of ConfigFile for Polar Game Engine

CopyrightCopyright (C) 2004-2008 John Goerzen, 2015 David Farrell
LicenseBSD3
MaintainerDavid Farrell <shokku.ra@gmail.com>
Stabilityunstable
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe
LanguageHaskell2010

Data.ConfigFile.Types

Description

Internal types for Data.ConfigFile. This module is not intended to be used directly by your programs.

Copyright (C) 2004-2008 John Goerzen <jgoerzen@complete.org>, 2015 David Farrell <shokku.ra@gmail.com>.

Synopsis

Documentation

type ConfigOptions = Map OptionName String Source

Storage of options.

type ConfigSections = Map SectionName ConfigOptions Source

The main data storage type (storage of sections).

PLEASE NOTE: This type is exported only for use by other modules under Data.ConfigFile. You should NEVER access the FiniteMap in a ConfigParser directly. This type may change in future releases of MissingH, which could break your programs. Please retrict yourself to the interface in ConfigFile.

data ConfigErrorType Source

Possible ConfigParser errors.

Constructors

ParseError String

Parse error

SectionAlreadyExists SectionName

Attempt to create an already-existing section

NoSection SectionName

The section does not exist

NoOption OptionName

The option does not exist

OtherProblem String

Miscellaneous error

InterpolationError String

Raised by interpolatingAccess if a request was made for a non-existant option

type ConfigError = (ConfigErrorType, String) Source

Indicates an error occurred. The String is an explanation of the location of the error.

data ConfigParser Source

This is the main record that is used by ConfigFile.

Constructors

ConfigParser 

Fields

content :: ConfigSections

The data itself

optionNameTransform :: OptionName -> OptionName

How to transform an option into a standard representation

defaultHandler :: ConfigParser -> SectionName -> OptionName -> Either ConfigError String

Function to look up an option, considering a default value if useDefault is True; or ignoring a default value otherwise. The option specification is assumed to be already transformed.

useDefault :: Bool

Whether or not to seek out a default action when no match is found.

accessFunction :: ConfigParser -> SectionName -> OptionName -> Either ConfigError String

Function that is used to perform lookups, do optional interpolation, etc. It is assumed that accessFunction will internally call defaultHandler to do the underlying lookup. The option value is not assumed to be transformed.

type SectionName = String Source

Names of sections

type OptionName = String Source

Names of options

type ParseOutput = [(String, [(String, String)])] Source

Internal output from parser