Sophie

Sophie

distrib > Fedora > 17 > i386 > media > updates > by-pkgid > a754cb499dfee5e1f453d3b6cc13d4c8 > files > 87

ghc-cmdargs-devel-0.9.3-1.fc17.i686.rpm

<!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>System.Console.CmdArgs.Annotate</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_System-Console-CmdArgs-Annotate.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/System-Console-CmdArgs-Annotate.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">cmdargs-0.9.3: Command line argument processing</p></div><div id="content"><div id="module-header"><p class="caption">System.Console.CmdArgs.Annotate</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Capture framework
</a></li><li><a href="#g:2">Impure
</a></li><li><a href="#g:3">Pure
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>This module captures annotations on a value, and builds a <code><a href="System-Console-CmdArgs-Annotate.html#t:Capture">Capture</a></code> value.
   This module has two ways of writing annotations:
</p><p><em>Impure</em>: The impure method of writing annotations is susceptible to over-optimisation by GHC
   - sometimes <code>{-# OPTIONS_GHC -fno-cse #-}</code> will be required.
</p><p><em>Pure</em>: The pure method is more verbose, and lacks some type safety.
</p><p>As an example of the two styles:
</p><pre> data Foo = Foo {foo :: Int, bar :: Int}
</pre><pre> impure = <code><a href="System-Console-CmdArgs-Annotate.html#v:capture">capture</a></code> $ Foo {foo = 12, bar = <code><a href="System-Console-CmdArgs-Annotate.html#v:many">many</a></code> [1 <code><a href="System-Console-CmdArgs-Annotate.html#v:-38--61-">&amp;=</a></code> &quot;inner&quot;, 2]} <code><a href="System-Console-CmdArgs-Annotate.html#v:-38--61-">&amp;=</a></code> &quot;top&quot;</pre><pre> pure = <code><a href="System-Console-CmdArgs-Annotate.html#v:capture_">capture_</a></code> $ <code><a href="System-Console-CmdArgs-Annotate.html#v:record">record</a></code> Foo{} [foo := 12, bar :=+ [<code><a href="System-Console-CmdArgs-Annotate.html#v:atom">atom</a></code> 1 <code><a href="System-Console-CmdArgs-Annotate.html#v:-43--61-">+=</a></code> &quot;inner&quot;, <code><a href="System-Console-CmdArgs-Annotate.html#v:atom">atom</a></code> 2]] <code><a href="System-Console-CmdArgs-Annotate.html#v:-43--61-">+=</a></code> &quot;top&quot;</pre><p>Both evaluate to:
</p><pre> Capture (Ann &quot;top&quot;) (Ctor (Foo 12 1) [Value 12, Many [Ann &quot;inner&quot; (Value 1), Value 2]]
</pre></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:Capture">Capture</a> ann<ul class="subs"><li>= <a href="#v:Many">Many</a> [<a href="System-Console-CmdArgs-Annotate.html#t:Capture">Capture</a> ann]  </li><li>| <a href="#v:Ann">Ann</a> ann (<a href="System-Console-CmdArgs-Annotate.html#t:Capture">Capture</a> ann)  </li><li>| <a href="#v:Value">Value</a> <a href="System-Console-CmdArgs-Annotate.html#t:Any">Any</a>  </li><li>| <a href="#v:Missing">Missing</a> <a href="System-Console-CmdArgs-Annotate.html#t:Any">Any</a>  </li><li>| <a href="#v:Ctor">Ctor</a> <a href="System-Console-CmdArgs-Annotate.html#t:Any">Any</a> [<a href="System-Console-CmdArgs-Annotate.html#t:Capture">Capture</a> ann]  </li></ul></li><li class="src short"><span class="keyword">data</span>  <a href="#t:Any">Any</a>  = <span class="keyword">forall</span> a . <a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> a =&gt; <a href="#v:Any">Any</a> a</li><li class="src short"><a href="#v:fromCapture">fromCapture</a> ::  <a href="System-Console-CmdArgs-Annotate.html#t:Capture">Capture</a> ann -&gt; <a href="System-Console-CmdArgs-Annotate.html#t:Any">Any</a></li><li class="src short"><a href="#v:defaultMissing">defaultMissing</a> ::  <a href="System-Console-CmdArgs-Annotate.html#t:Capture">Capture</a> ann -&gt; <a href="System-Console-CmdArgs-Annotate.html#t:Capture">Capture</a> ann</li><li class="src short"><a href="#v:capture">capture</a> :: (<a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> val, <a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> ann) =&gt; val -&gt; <a href="System-Console-CmdArgs-Annotate.html#t:Capture">Capture</a> ann</li><li class="src short"><a href="#v:many">many</a> :: <a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> val =&gt; [val] -&gt; val</li><li class="src short"><a href="#v:-38--61-">(&amp;=)</a> :: (<a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> val, <a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> ann) =&gt; val -&gt; ann -&gt; val</li><li class="src short"><a href="#v:capture_">capture_</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Text-Show.html#t:Show">Show</a> a =&gt; <a href="System-Console-CmdArgs-Annotate.html#t:Annotate">Annotate</a> a -&gt; <a href="System-Console-CmdArgs-Annotate.html#t:Capture">Capture</a> a</li><li class="src short"><a href="#v:many_">many_</a> ::  [<a href="System-Console-CmdArgs-Annotate.html#t:Annotate">Annotate</a> a] -&gt; <a href="System-Console-CmdArgs-Annotate.html#t:Annotate">Annotate</a> a</li><li class="src short"><a href="#v:-43--61-">(+=)</a> ::  <a href="System-Console-CmdArgs-Annotate.html#t:Annotate">Annotate</a> ann -&gt; ann -&gt; <a href="System-Console-CmdArgs-Annotate.html#t:Annotate">Annotate</a> ann</li><li class="src short"><a href="#v:atom">atom</a> :: <a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> val =&gt; val -&gt; <a href="System-Console-CmdArgs-Annotate.html#t:Annotate">Annotate</a> ann</li><li class="src short"><a href="#v:record">record</a> :: <a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> a =&gt; a -&gt; [<a href="System-Console-CmdArgs-Annotate.html#t:Annotate">Annotate</a> ann] -&gt; <a href="System-Console-CmdArgs-Annotate.html#t:Annotate">Annotate</a> ann</li><li class="src short"><span class="keyword">data</span>  <a href="#t:Annotate">Annotate</a> ann<ul class="subs"><li>= <span class="keyword">forall</span> c f . (<a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> c, <a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> f) =&gt; (c -&gt; f) <a href="#v::-61-">:=</a> f  </li><li>| <span class="keyword">forall</span> c f . (<a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> c, <a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> f) =&gt; (c -&gt; f) <a href="#v::-61--43-">:=+</a> [<a href="System-Console-CmdArgs-Annotate.html#t:Annotate">Annotate</a> ann]  </li></ul></li></ul></div><div id="interface"><h1 id="g:1">Capture framework
</h1><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:Capture" class="def">Capture</a> ann <a href="src/System-Console-CmdArgs-Annotate.html#Capture" class="link">Source</a></p><div class="doc"><p>The result of capturing some annotations.
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:Many" class="def">Many</a> [<a href="System-Console-CmdArgs-Annotate.html#t:Capture">Capture</a> ann]</td><td class="doc"><p>Many values collapsed (<code><a href="System-Console-CmdArgs-Annotate.html#v:many">many</a></code> or <code><a href="System-Console-CmdArgs-Annotate.html#v:many_">many_</a></code>)
</p></td></tr><tr><td class="src"><a name="v:Ann" class="def">Ann</a> ann (<a href="System-Console-CmdArgs-Annotate.html#t:Capture">Capture</a> ann)</td><td class="doc"><p>An annotation attached to a value (<code><a href="System-Console-CmdArgs-Annotate.html#v:-38--61-">&amp;=</a></code> or <code><a href="System-Console-CmdArgs-Annotate.html#v:-43--61-">+=</a></code>)
</p></td></tr><tr><td class="src"><a name="v:Value" class="def">Value</a> <a href="System-Console-CmdArgs-Annotate.html#t:Any">Any</a></td><td class="doc"><p>A value (just a value, or <code><a href="System-Console-CmdArgs-Annotate.html#v:atom">atom</a></code>)
</p></td></tr><tr><td class="src"><a name="v:Missing" class="def">Missing</a> <a href="System-Console-CmdArgs-Annotate.html#t:Any">Any</a></td><td class="doc"><p>A missing field (a <code><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Control-Exception-Base.html#t:RecConError">RecConError</a></code> exception, or missing from <code><a href="System-Console-CmdArgs-Annotate.html#v:record">record</a></code>)
</p></td></tr><tr><td class="src"><a name="v:Ctor" class="def">Ctor</a> <a href="System-Console-CmdArgs-Annotate.html#t:Any">Any</a> [<a href="System-Console-CmdArgs-Annotate.html#t:Capture">Capture</a> ann]</td><td class="doc"><p>A constructor (a constructor, or <code><a href="System-Console-CmdArgs-Annotate.html#v:record">record</a></code>)
</p></td></tr></table></div><div class="subs instances"><p id="control.i:Capture" class="caption collapser" onclick="toggleSection('i:Capture')">Instances</p><div id="section.i:Capture" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Control-Monad.html#t:Functor">Functor</a> <a href="System-Console-CmdArgs-Annotate.html#t:Capture">Capture</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Text-Show.html#t:Show">Show</a> ann =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Text-Show.html#t:Show">Show</a> (<a href="System-Console-CmdArgs-Annotate.html#t:Capture">Capture</a> ann)</td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:Any" class="def">Any</a>  <a href="src/Data-Generics-Any.html#Any" class="link">Source</a></p><div class="doc"><p>Any value, with a Data dictionary.
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><span class="keyword">forall</span> a . <a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> a =&gt; <a name="v:Any" class="def">Any</a> a</td><td class="doc empty">&nbsp;</td></tr></table></div><div class="subs instances"><p id="control.i:Any" class="caption collapser" onclick="toggleSection('i:Any')">Instances</p><div id="section.i:Any" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Text-Show.html#t:Show">Show</a> <a href="System-Console-CmdArgs-Annotate.html#t:Any">Any</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:fromCapture" class="def">fromCapture</a> ::  <a href="System-Console-CmdArgs-Annotate.html#t:Capture">Capture</a> ann -&gt; <a href="System-Console-CmdArgs-Annotate.html#t:Any">Any</a><a href="src/System-Console-CmdArgs-Annotate.html#fromCapture" class="link">Source</a></p><div class="doc"><p>Return the value inside a capture.
</p></div></div><div class="top"><p class="src"><a name="v:defaultMissing" class="def">defaultMissing</a> ::  <a href="System-Console-CmdArgs-Annotate.html#t:Capture">Capture</a> ann -&gt; <a href="System-Console-CmdArgs-Annotate.html#t:Capture">Capture</a> ann<a href="src/System-Console-CmdArgs-Annotate.html#defaultMissing" class="link">Source</a></p><div class="doc"><p>Remove all Missing values by using any previous instances as default values
</p></div></div><h1 id="g:2">Impure
</h1><div class="top"><p class="src"><a name="v:capture" class="def">capture</a> :: (<a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> val, <a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> ann) =&gt; val -&gt; <a href="System-Console-CmdArgs-Annotate.html#t:Capture">Capture</a> ann<a href="src/System-Console-CmdArgs-Annotate.html#capture" class="link">Source</a></p><div class="doc"><p>Capture a value. Note that if the value is evaluated
   more than once the result may be different, i.e.
</p><pre> capture x /= capture x
</pre></div></div><div class="top"><p class="src"><a name="v:many" class="def">many</a> :: <a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> val =&gt; [val] -&gt; val<a href="src/System-Console-CmdArgs-Annotate.html#many" class="link">Source</a></p><div class="doc"><p>Collapse multiple values in to one.
</p></div></div><div class="top"><p class="src"><a name="v:-38--61-" class="def">(&amp;=)</a> :: (<a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> val, <a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> ann) =&gt; val -&gt; ann -&gt; val<a href="src/System-Console-CmdArgs-Annotate.html#%26%3D" class="link">Source</a></p><div class="doc"><p>Add an annotation to a value.
</p><p>It is recommended that anyone making use of this function redefine
   it with a more restrictive type signature to control the type of the
   annotation (the second argument). Any redefinitions of this function
   should add an INLINE pragma, to reduce the chance of incorrect
   optimisations.
</p></div></div><h1 id="g:3">Pure
</h1><div class="top"><p class="src"><a name="v:capture_" class="def">capture_</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Text-Show.html#t:Show">Show</a> a =&gt; <a href="System-Console-CmdArgs-Annotate.html#t:Annotate">Annotate</a> a -&gt; <a href="System-Console-CmdArgs-Annotate.html#t:Capture">Capture</a> a<a href="src/System-Console-CmdArgs-Annotate.html#capture_" class="link">Source</a></p><div class="doc"><p>Capture the annotations from an annotated value.
</p></div></div><div class="top"><p class="src"><a name="v:many_" class="def">many_</a> ::  [<a href="System-Console-CmdArgs-Annotate.html#t:Annotate">Annotate</a> a] -&gt; <a href="System-Console-CmdArgs-Annotate.html#t:Annotate">Annotate</a> a<a href="src/System-Console-CmdArgs-Annotate.html#many_" class="link">Source</a></p><div class="doc"><p>Collapse many annotated values in to one.
</p></div></div><div class="top"><p class="src"><a name="v:-43--61-" class="def">(+=)</a> ::  <a href="System-Console-CmdArgs-Annotate.html#t:Annotate">Annotate</a> ann -&gt; ann -&gt; <a href="System-Console-CmdArgs-Annotate.html#t:Annotate">Annotate</a> ann<a href="src/System-Console-CmdArgs-Annotate.html#%2B%3D" class="link">Source</a></p><div class="doc"><p>Add an annotation to a value.
</p></div></div><div class="top"><p class="src"><a name="v:atom" class="def">atom</a> :: <a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> val =&gt; val -&gt; <a href="System-Console-CmdArgs-Annotate.html#t:Annotate">Annotate</a> ann<a href="src/System-Console-CmdArgs-Annotate.html#atom" class="link">Source</a></p><div class="doc"><p>Lift a pure value to an annotation.
</p></div></div><div class="top"><p class="src"><a name="v:record" class="def">record</a> :: <a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> a =&gt; a -&gt; [<a href="System-Console-CmdArgs-Annotate.html#t:Annotate">Annotate</a> ann] -&gt; <a href="System-Console-CmdArgs-Annotate.html#t:Annotate">Annotate</a> ann<a href="src/System-Console-CmdArgs-Annotate.html#record" class="link">Source</a></p><div class="doc"><p>Create a constructor/record. The first argument should be
   the type of field, the second should be a list of fields constructed
   originally defined by <code>:=</code> or <code>:=+</code>.
</p><p>This operation is not type safe, and may raise an exception at runtime
   if any field has the wrong type or label.
</p></div></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:Annotate" class="def">Annotate</a> ann <a href="src/System-Console-CmdArgs-Annotate.html#Annotate" class="link">Source</a></p><div class="doc"><p>This type represents an annotated value. The type of the underlying value is not specified.
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><span class="keyword">forall</span> c f . (<a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> c, <a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> f) =&gt; (c -&gt; f) <a name="v::-61-" class="def">:=</a> f</td><td class="doc"><p>Construct a field, <code>fieldname := value</code>.
</p></td></tr><tr><td class="src"><span class="keyword">forall</span> c f . (<a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> c, <a href="System-Console-CmdArgs-Implicit.html#t:Data">Data</a> f) =&gt; (c -&gt; f) <a name="v::-61--43-" class="def">:=+</a> [<a href="System-Console-CmdArgs-Annotate.html#t:Annotate">Annotate</a> ann]</td><td class="doc"><p>Add annotations to a field.
</p></td></tr></table></div><div class="subs instances"><p id="control.i:Annotate" class="caption collapser" onclick="toggleSection('i:Annotate')">Instances</p><div id="section.i:Annotate" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable1">Typeable1</a> <a href="System-Console-CmdArgs-Annotate.html#t:Annotate">Annotate</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.2</p></div></body></html>