/usr/share/doc/libghc-configurator-doc/html/Data-Configurator.html is in libghc-configurator-doc 0.3.0.0-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Data.Configurator</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Data-Configurator.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Configurator.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">configurator-0.3.0.0: Configuration management</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Copyright</th><td>(c) 2011 MailRank, Inc.</td></tr><tr><th>License</th><td>BSD3</td></tr><tr><th>Maintainer</th><td>Bryan O'Sullivan <bos@serpentine.com></td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Portability</th><td>portable</td></tr><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Data.Configurator</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Configuration file format</a><ul><li><a href="#g:2">Binding a name to a value</a><ul><li><a href="#g:3">Value types</a></li><li><a href="#g:4">String interpolation</a></li></ul></li><li><a href="#g:5">Grouping directives</a></li><li><a href="#g:6">Importing files</a></li></ul></li><li><a href="#g:7">Types</a></li><li><a href="#g:8">Loading configuration data</a></li><li><a href="#g:9">Lookup functions</a></li><li><a href="#g:10">Notification of configuration changes</a></li><li><a href="#g:11">Low-level loading functions</a></li><li><a href="#g:12">Helper functions</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>A simple (yet powerful) library for working with configuration
files.</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:Worth">Worth</a> a<ul class="subs"><li>= <a href="#v:Required">Required</a> { <ul class="subs"><li><a href="#v:worth">worth</a> :: a</li></ul> }</li><li>| <a href="#v:Optional">Optional</a> { <ul class="subs"><li><a href="#v:worth">worth</a> :: a</li></ul> }</li></ul></li><li class="src short"><a href="#v:autoReload">autoReload</a> :: <a href="Data-Configurator-Types.html#t:AutoConfig">AutoConfig</a> -> [<a href="Data-Configurator.html#t:Worth">Worth</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a>] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> (<a href="Data-Configurator-Types.html#t:Config">Config</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Concurrent.html#t:ThreadId">ThreadId</a>)</li><li class="src short"><a href="#v:autoReloadGroups">autoReloadGroups</a> :: <a href="Data-Configurator-Types.html#t:AutoConfig">AutoConfig</a> -> [(<a href="Data-Configurator-Types.html#t:Name">Name</a>, <a href="Data-Configurator.html#t:Worth">Worth</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a>)] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> (<a href="Data-Configurator-Types.html#t:Config">Config</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Concurrent.html#t:ThreadId">ThreadId</a>)</li><li class="src short"><a href="#v:autoConfig">autoConfig</a> :: <a href="Data-Configurator-Types.html#t:AutoConfig">AutoConfig</a></li><li class="src short"><a href="#v:empty">empty</a> :: <a href="Data-Configurator-Types.html#t:Config">Config</a></li><li class="src short"><a href="#v:lookup">lookup</a> :: <a href="Data-Configurator-Types.html#t:Configured">Configured</a> a => <a href="Data-Configurator-Types.html#t:Config">Config</a> -> <a href="Data-Configurator-Types.html#t:Name">Name</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</li><li class="src short"><a href="#v:lookupDefault">lookupDefault</a> :: <a href="Data-Configurator-Types.html#t:Configured">Configured</a> a => a -> <a href="Data-Configurator-Types.html#t:Config">Config</a> -> <a href="Data-Configurator-Types.html#t:Name">Name</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> a</li><li class="src short"><a href="#v:require">require</a> :: <a href="Data-Configurator-Types.html#t:Configured">Configured</a> a => <a href="Data-Configurator-Types.html#t:Config">Config</a> -> <a href="Data-Configurator-Types.html#t:Name">Name</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> a</li><li class="src short"><a href="#v:prefix">prefix</a> :: <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> -> <a href="Data-Configurator-Types.html#t:Pattern">Pattern</a></li><li class="src short"><a href="#v:exact">exact</a> :: <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> -> <a href="Data-Configurator-Types.html#t:Pattern">Pattern</a></li><li class="src short"><a href="#v:subscribe">subscribe</a> :: <a href="Data-Configurator-Types.html#t:Config">Config</a> -> <a href="Data-Configurator-Types.html#t:Pattern">Pattern</a> -> <a href="Data-Configurator-Types.html#t:ChangeHandler">ChangeHandler</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:load">load</a> :: [<a href="Data-Configurator.html#t:Worth">Worth</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a>] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> <a href="Data-Configurator-Types.html#t:Config">Config</a></li><li class="src short"><a href="#v:loadGroups">loadGroups</a> :: [(<a href="Data-Configurator-Types.html#t:Name">Name</a>, <a href="Data-Configurator.html#t:Worth">Worth</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a>)] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> <a href="Data-Configurator-Types.html#t:Config">Config</a></li><li class="src short"><a href="#v:reload">reload</a> :: <a href="Data-Configurator-Types.html#t:Config">Config</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:subconfig">subconfig</a> :: <a href="Data-Configurator-Types.html#t:Name">Name</a> -> <a href="Data-Configurator-Types.html#t:Config">Config</a> -> <a href="Data-Configurator-Types.html#t:Config">Config</a></li><li class="src short"><a href="#v:addToConfig">addToConfig</a> :: [<a href="Data-Configurator.html#t:Worth">Worth</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a>] -> <a href="Data-Configurator-Types.html#t:Config">Config</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:addGroupsToConfig">addGroupsToConfig</a> :: [(<a href="Data-Configurator-Types.html#t:Name">Name</a>, <a href="Data-Configurator.html#t:Worth">Worth</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a>)] -> <a href="Data-Configurator-Types.html#t:Config">Config</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:display">display</a> :: <a href="Data-Configurator-Types.html#t:Config">Config</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:getMap">getMap</a> :: <a href="Data-Configurator-Types.html#t:Config">Config</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> (<a href="file:///usr/share/doc/libghc-unordered-containers-doc/html/Data-HashMap-Strict.html#t:HashMap">HashMap</a> <a href="Data-Configurator-Types.html#t:Name">Name</a> <a href="Data-Configurator-Types.html#t:Value">Value</a>)</li></ul></div><div id="interface"><h1 id="g:1">Configuration file format</h1><div class="doc"><p>A configuration file consists of a series of directives and
comments, encoded in UTF-8. A comment begins with a "<code>#</code>"
character, and continues to the end of a line.</p><p>Files and directives are processed from first to last, top to
bottom.</p></div><h2 id="g:2">Binding a name to a value</h2><div class="doc"><p>A binding associates a name with a value.</p><pre>my_string = "hi mom! \u2603"
your-int-33 = 33
his_bool = on
HerList = [1, "foo", off]</pre><p>A name must begin with a Unicode letter, which is followed by zero
or more of a Unicode alphanumeric code point, hyphen "<code>-</code>", or
underscore "<code>_</code>".</p><p>Bindings are created or overwritten in the order in which they are
encountered. It is legitimate for a name to be bound multiple
times, in which case the last value wins.</p><pre>a = 1
a = true
# value of a is now true, not 1</pre></div><h3 id="g:3">Value types</h3><div class="doc"><p>The configuration file format supports the following data types:</p><ul><li>Booleans, represented as <code>on</code> or <code>off</code>, <code>true</code> or <code>false</code>. These
are case sensitive, so do not try to use <code>True</code> instead of
<code>true</code>!</li><li>Integers, represented in base 10.</li><li>Unicode strings, represented as text (possibly containing escape
sequences) surrounded by double quotes.</li><li>Heterogeneous lists of values, represented as an opening square
bracket "<code>[</code>", followed by a series of comma-separated values,
ending with a closing square bracket "<code>]</code>".</li></ul><p>The following escape sequences are recognised in a text string:</p><ul><li><code>\n</code> - newline</li><li><code>\r</code> - carriage return</li><li><code>\t</code> - horizontal tab</li><li><code>\\</code> - backslash</li><li><code>\"</code> - double quote</li><li><code>\u</code><em>xxxx</em> - Unicode character from the basic multilingual
plane, encoded as four hexadecimal digits</li><li><code>\u</code><em>xxxx</em><code>\u</code><em>xxxx</em> - Unicode character from an astral plane,
as two hexadecimal-encoded UTF-16 surrogates</li></ul></div><h3 id="g:4">String interpolation</h3><div class="doc"><p>Strings support interpolation, so that you can dynamically
construct a string based on data in your configuration or the OS
environment.</p><p>If a string value contains the special sequence "<code>$(foo)</code>" (for
any name <code>foo</code>), then the name <code>foo</code> will be looked up in the
configuration data and its value substituted. If that name cannot
be found, it will be looked up in the OS environment.</p><p>For security reasons, it is an error for a string interpolation
fragment to contain a name that cannot be found in either the
current configuration or the environment.</p><p>To represent a single literal "<code>$</code>" character in a string, double
it: "<code>$$</code>".</p></div><h2 id="g:5">Grouping directives</h2><div class="doc"><p>It is possible to group a number of directives together under a
single prefix:</p><pre>my-group
{
a = 1
# groups support nesting
nested {
b = "yay!"
}
}</pre><p>The name of a group is used as a prefix for the items in the
group. For instance, the value of "<code>a</code>" above can be retrieved
using <code><a href="Data-Configurator.html#v:lookup">lookup</a></code> by supplying the name "<code>my-group.a</code>", and "<code>b</code>"
will be named "<code>my-group.nested.b</code>".</p></div><h2 id="g:6">Importing files</h2><div class="doc"><p>To import the contents of another configuration file, use the
<code>import</code> directive.</p><pre>import "$(HOME)/etc/myapp.cfg"</pre><p>Absolute paths are imported as is. Relative paths are resolved with
respect to the file they are imported from. It is an error for an
<code>import</code> directive to name a file that does not exist, cannot be read,
or contains errors.</p><p>If an <code>import</code> appears inside a group, the group's naming prefix
will be applied to all of the names imported from the given
configuration file.</p><p>Supposing we have a file named "<code>foo.cfg</code>":</p><pre>bar = 1</pre><p>And another file that imports it into a group:</p><pre>hi {
import "foo.cfg"
}</pre><p>This will result in a value named "<code>hi.bar</code>".</p></div><h1 id="g:7">Types</h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Worth" class="def">Worth</a> a <a href="src/Data-Configurator-Types-Internal.html#Worth" class="link">Source</a></p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:Required" class="def">Required</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><dl><dt class="src"><a name="v:worth" class="def">worth</a> :: a</dt><dd class="doc empty"> </dd></dl><div class="clear"></div></div></td></tr><tr><td class="src"><a name="v:Optional" class="def">Optional</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><dl><dt class="src"><a name="v:worth" class="def">worth</a> :: a</dt><dd class="doc empty"> </dd></dl><div class="clear"></div></div></td></tr></table></div><div class="subs instances"><p id="control.i:Worth" class="caption collapser" onclick="toggleSection('i:Worth')">Instances</p><div id="section.i:Worth" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> <a href="Data-Configurator.html#t:Worth">Worth</a></span> <a href="src/Data-Configurator-Types-Internal.html#line-72" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> a => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> (<a href="Data-Configurator.html#t:Worth">Worth</a> a)</span> <a href="src/Data-Configurator-Types-Internal.html#line-53" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> a => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> (<a href="Data-Configurator.html#t:Worth">Worth</a> a)</span> <a href="src/Data-Configurator-Types-Internal.html#line-48" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:IsString">IsString</a> (<a href="Data-Configurator.html#t:Worth">Worth</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a>)</span> <a href="src/Data-Configurator-Types-Internal.html#line-50" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-hashable-doc/html/Data-Hashable.html#t:Hashable">Hashable</a> a => <a href="file:///usr/share/doc/libghc-hashable-doc/html/Data-Hashable.html#t:Hashable">Hashable</a> (<a href="Data-Configurator.html#t:Worth">Worth</a> a)</span> <a href="src/Data-Configurator-Types-Internal.html#line-56" class="link">Source</a></td><td class="doc empty"> </td></tr></table></div></div></div><h1 id="g:8">Loading configuration data</h1><div class="top"><p class="src"><a name="v:autoReload" class="def">autoReload</a> <a href="src/Data-Configurator.html#autoReload" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Data-Configurator-Types.html#t:AutoConfig">AutoConfig</a></td><td class="doc"><p>Directions for when to reload and how to handle
errors.</p></td></tr><tr><td class="src">-> [<a href="Data-Configurator.html#t:Worth">Worth</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a>]</td><td class="doc"><p>Configuration files to load.</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> (<a href="Data-Configurator-Types.html#t:Config">Config</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Concurrent.html#t:ThreadId">ThreadId</a>)</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Load a <code><a href="Data-Configurator-Types.html#t:Config">Config</a></code> from the given <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a></code>s, and start a reload
thread.</p><p>At intervals, a thread checks for modifications to both the
original files and any files they refer to in <code>import</code> directives,
and reloads the <code><a href="Data-Configurator-Types.html#t:Config">Config</a></code> if any files have been modified.</p><p>If the initial attempt to load the configuration files fails, an
exception is thrown. If the initial load succeeds, but a
subsequent attempt fails, the <code><a href="Data-Configurator-Types.html#v:onError">onError</a></code> handler is invoked.</p><p>File names have any environment variables expanded prior to the
first time they are opened, so you can specify a file name such as
<code>"$(HOME)/myapp.cfg"</code>.</p></div></div><div class="top"><p class="src"><a name="v:autoReloadGroups" class="def">autoReloadGroups</a> :: <a href="Data-Configurator-Types.html#t:AutoConfig">AutoConfig</a> -> [(<a href="Data-Configurator-Types.html#t:Name">Name</a>, <a href="Data-Configurator.html#t:Worth">Worth</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a>)] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> (<a href="Data-Configurator-Types.html#t:Config">Config</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Concurrent.html#t:ThreadId">ThreadId</a>) <a href="src/Data-Configurator.html#autoReloadGroups" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:autoConfig" class="def">autoConfig</a> :: <a href="Data-Configurator-Types.html#t:AutoConfig">AutoConfig</a> <a href="src/Data-Configurator.html#autoConfig" class="link">Source</a></p><div class="doc"><p>Defaults for automatic <code><a href="Data-Configurator-Types.html#t:Config">Config</a></code> reloading when using
<code><a href="Data-Configurator.html#v:autoReload">autoReload</a></code>. The <code><a href="Data-Configurator-Types.html#v:interval">interval</a></code> is one second, while the <code><a href="Data-Configurator-Types.html#v:onError">onError</a></code>
action ignores its argument and does nothing.</p></div></div><div class="top"><p class="src"><a name="v:empty" class="def">empty</a> :: <a href="Data-Configurator-Types.html#t:Config">Config</a> <a href="src/Data-Configurator.html#empty" class="link">Source</a></p><div class="doc"><p>A completely empty configuration.</p></div></div><h1 id="g:9">Lookup functions</h1><div class="top"><p class="src"><a name="v:lookup" class="def">lookup</a> :: <a href="Data-Configurator-Types.html#t:Configured">Configured</a> a => <a href="Data-Configurator-Types.html#t:Config">Config</a> -> <a href="Data-Configurator-Types.html#t:Name">Name</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> a) <a href="src/Data-Configurator.html#lookup" class="link">Source</a></p><div class="doc"><p>Look up a name in the given <code><a href="Data-Configurator-Types.html#t:Config">Config</a></code>. If a binding exists, and
the value can be <code><a href="Data-Configurator-Types.html#v:convert">convert</a></code>ed to the desired type, return the
converted value, otherwise <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#v:Nothing">Nothing</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:lookupDefault" class="def">lookupDefault</a> <a href="src/Data-Configurator.html#lookupDefault" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Data-Configurator-Types.html#t:Configured">Configured</a> a</td><td class="doc empty"> </td></tr><tr><td class="src">=> a</td><td class="doc"><p>Default value to return if <code><a href="Data-Configurator.html#v:lookup">lookup</a></code> or <code><a href="Data-Configurator-Types.html#v:convert">convert</a></code>
fails.</p></td></tr><tr><td class="src">-> <a href="Data-Configurator-Types.html#t:Config">Config</a></td><td class="doc empty"> </td></tr><tr><td class="src">-> <a href="Data-Configurator-Types.html#t:Name">Name</a></td><td class="doc empty"> </td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> a</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Look up a name in the given <code><a href="Data-Configurator-Types.html#t:Config">Config</a></code>. If a binding exists, and
the value can be converted to the desired type, return it,
otherwise return the default value.</p></div></div><div class="top"><p class="src"><a name="v:require" class="def">require</a> :: <a href="Data-Configurator-Types.html#t:Configured">Configured</a> a => <a href="Data-Configurator-Types.html#t:Config">Config</a> -> <a href="Data-Configurator-Types.html#t:Name">Name</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> a <a href="src/Data-Configurator.html#require" class="link">Source</a></p><div class="doc"><p>Look up a name in the given <code><a href="Data-Configurator-Types.html#t:Config">Config</a></code>. If a binding exists, and
the value can be <code><a href="Data-Configurator-Types.html#v:convert">convert</a></code>ed to the desired type, return the
converted value, otherwise throw a <code><a href="Data-Configurator-Types.html#t:KeyError">KeyError</a></code>.</p></div></div><h1 id="g:10">Notification of configuration changes</h1><div class="doc"><p>To more efficiently support an application's need to dynamically
reconfigure, a subsystem may ask to be notified when a
configuration property is changed as a result of a reload, using
the <code><a href="Data-Configurator.html#v:subscribe">subscribe</a></code> action.</p></div><div class="top"><p class="src"><a name="v:prefix" class="def">prefix</a> :: <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> -> <a href="Data-Configurator-Types.html#t:Pattern">Pattern</a> <a href="src/Data-Configurator-Types-Internal.html#prefix" class="link">Source</a></p><div class="doc"><p>A pattern that matches on a prefix of a property name. Given
<code>"foo"</code>, this will match <code>"foo.bar"</code>, but not <code>"foo"</code> or
<code>"foobar"</code>.</p></div></div><div class="top"><p class="src"><a name="v:exact" class="def">exact</a> :: <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> -> <a href="Data-Configurator-Types.html#t:Pattern">Pattern</a> <a href="src/Data-Configurator-Types-Internal.html#exact" class="link">Source</a></p><div class="doc"><p>A pattern that must match exactly.</p></div></div><div class="top"><p class="src"><a name="v:subscribe" class="def">subscribe</a> :: <a href="Data-Configurator-Types.html#t:Config">Config</a> -> <a href="Data-Configurator-Types.html#t:Pattern">Pattern</a> -> <a href="Data-Configurator-Types.html#t:ChangeHandler">ChangeHandler</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> () <a href="src/Data-Configurator.html#subscribe" class="link">Source</a></p><div class="doc"><p>Subscribe for notifications. The given action will be invoked
when any change occurs to a configuration property matching the
supplied pattern.</p></div></div><h1 id="g:11">Low-level loading functions</h1><div class="top"><p class="src"><a name="v:load" class="def">load</a> :: [<a href="Data-Configurator.html#t:Worth">Worth</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a>] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> <a href="Data-Configurator-Types.html#t:Config">Config</a> <a href="src/Data-Configurator.html#load" class="link">Source</a></p><div class="doc"><p>Create a <code><a href="Data-Configurator-Types.html#t:Config">Config</a></code> from the contents of the named files. Throws an
exception on error, such as if files do not exist or contain errors.</p><p>File names have any environment variables expanded prior to the
first time they are opened, so you can specify a file name such as
<code>"$(HOME)/myapp.cfg"</code>.</p></div></div><div class="top"><p class="src"><a name="v:loadGroups" class="def">loadGroups</a> :: [(<a href="Data-Configurator-Types.html#t:Name">Name</a>, <a href="Data-Configurator.html#t:Worth">Worth</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a>)] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> <a href="Data-Configurator-Types.html#t:Config">Config</a> <a href="src/Data-Configurator.html#loadGroups" class="link">Source</a></p><div class="doc"><p>Create a <code><a href="Data-Configurator-Types.html#t:Config">Config</a></code> from the contents of the named files, placing them
into named prefixes. If a prefix is non-empty, it should end in a
dot.</p></div></div><div class="top"><p class="src"><a name="v:reload" class="def">reload</a> :: <a href="Data-Configurator-Types.html#t:Config">Config</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> () <a href="src/Data-Configurator.html#reload" class="link">Source</a></p><div class="doc"><p>Forcibly reload a <code><a href="Data-Configurator-Types.html#t:Config">Config</a></code>. Throws an exception on error, such as
if files no longer exist or contain errors. If the provided <code><a href="Data-Configurator-Types.html#t:Config">Config</a></code> is
a <code><a href="Data-Configurator.html#v:subconfig">subconfig</a></code>, this will reload the entire top-level configuration, not just
the local section.</p></div></div><div class="top"><p class="src"><a name="v:subconfig" class="def">subconfig</a> :: <a href="Data-Configurator-Types.html#t:Name">Name</a> -> <a href="Data-Configurator-Types.html#t:Config">Config</a> -> <a href="Data-Configurator-Types.html#t:Config">Config</a> <a href="src/Data-Configurator.html#subconfig" class="link">Source</a></p><div class="doc"><p>Gives a <code><a href="Data-Configurator-Types.html#t:Config">Config</a></code> corresponding to just a single group of the original
<code><a href="Data-Configurator-Types.html#t:Config">Config</a></code>. The subconfig can be used just like the original <code><a href="Data-Configurator-Types.html#t:Config">Config</a></code>, but
see the documentation for <code><a href="Data-Configurator.html#v:reload">reload</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:addToConfig" class="def">addToConfig</a> :: [<a href="Data-Configurator.html#t:Worth">Worth</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a>] -> <a href="Data-Configurator-Types.html#t:Config">Config</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> () <a href="src/Data-Configurator.html#addToConfig" class="link">Source</a></p><div class="doc"><p>Add additional files to a <code><a href="Data-Configurator-Types.html#t:Config">Config</a></code>, causing it to be reloaded to add
their contents.</p></div></div><div class="top"><p class="src"><a name="v:addGroupsToConfig" class="def">addGroupsToConfig</a> :: [(<a href="Data-Configurator-Types.html#t:Name">Name</a>, <a href="Data-Configurator.html#t:Worth">Worth</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a>)] -> <a href="Data-Configurator-Types.html#t:Config">Config</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> () <a href="src/Data-Configurator.html#addGroupsToConfig" class="link">Source</a></p><div class="doc"><p>Add additional files to named groups in a <code><a href="Data-Configurator-Types.html#t:Config">Config</a></code>, causing it to be
reloaded to add their contents. If the prefixes are non-empty, they should
end in dots.</p></div></div><h1 id="g:12">Helper functions</h1><div class="top"><p class="src"><a name="v:display" class="def">display</a> :: <a href="Data-Configurator-Types.html#t:Config">Config</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> () <a href="src/Data-Configurator.html#display" class="link">Source</a></p><div class="doc"><p>Perform a simple dump of a <code><a href="Data-Configurator-Types.html#t:Config">Config</a></code> to <code>stdout</code>.</p></div></div><div class="top"><p class="src"><a name="v:getMap" class="def">getMap</a> :: <a href="Data-Configurator-Types.html#t:Config">Config</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> (<a href="file:///usr/share/doc/libghc-unordered-containers-doc/html/Data-HashMap-Strict.html#t:HashMap">HashMap</a> <a href="Data-Configurator-Types.html#t:Name">Name</a> <a href="Data-Configurator-Types.html#t:Value">Value</a>) <a href="src/Data-Configurator.html#getMap" class="link">Source</a></p><div class="doc"><p>Fetch the <code><a href="file:///usr/share/doc/libghc-unordered-containers-doc/html/Data-HashMap-Strict.html#t:HashMap">HashMap</a></code> that maps names to values.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>
|