Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release > by-pkgid > 6e204a966e8c42d976f99a1700ce5f20 > files > 2239

ghc-7.4.2-4.mga5.i586.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>Data.Data</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-Data.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">base-4.5.1.0: Basic libraries</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>non-portable (local universal quantification)</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Maintainer</th><td>libraries@haskell.org</td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr></table><p class="caption">Data.Data</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Module Data.Typeable re-exported for convenience
</a></li><li><a href="#g:2">The Data class for processing constructor applications
</a></li><li><a href="#g:3">Datatype representations
</a><ul><li><a href="#g:4">Constructors
</a></li><li><a href="#g:5">Observers
</a></li><li><a href="#g:6">Convenience functions
</a></li></ul></li><li><a href="#g:7">Data constructor representations
</a><ul><li><a href="#g:8">Constructors
</a></li><li><a href="#g:9">Observers
</a></li><li><a href="#g:10">Convenience function: algebraic data types
</a></li><li><a href="#g:11">From strings to constructors and vice versa: all data types
</a></li></ul></li><li><a href="#g:12">Convenience functions: take type constructors apart
</a></li><li><a href="#g:13">Generic operations defined in terms of <code><a href="Data-Data.html#v:gunfold">gunfold</a></code>
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>&quot;Scrap your boilerplate&quot; --- Generic programming in Haskell.
 See <a href="http://www.cs.vu.nl/boilerplate/">http://www.cs.vu.nl/boilerplate/</a>. This module provides
 the <code><a href="Data-Data.html#t:Data">Data</a></code> class with its primitives for generic programming, along
 with instances for many datatypes. It corresponds to a merge between
 the previous <a href="Data-Generics-Basics.html">Data.Generics.Basics</a> and almost all of 
 <a href="Data-Generics-Instances.html">Data.Generics.Instances</a>. The instances that are not present
 in this module were moved to the <code>Data.Generics.Instances</code> module
 in the <code>syb</code> package.
</p><p>For more information, please visit the new
 SYB wiki: <a href="http://www.cs.uu.nl/wiki/bin/view/GenericProgramming/SYB">http://www.cs.uu.nl/wiki/bin/view/GenericProgramming/SYB</a>.
</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">module <a href="Data-Typeable.html">Data.Typeable</a></li><li class="src short"><span class="keyword">class</span> <a href="Data-Typeable-Internal.html#t:Typeable">Typeable</a> a =&gt; <a href="#t:Data">Data</a> a  <span class="keyword">where</span><ul class="subs"><li><a href="#v:gfoldl">gfoldl</a> ::  (<span class="keyword">forall</span> d b. <a href="Data-Data.html#t:Data">Data</a> d =&gt; c (d -&gt; b) -&gt; d -&gt; c b) -&gt; (<span class="keyword">forall</span> g.  g -&gt; c g) -&gt; a -&gt; c a</li><li><a href="#v:gunfold">gunfold</a> ::  (<span class="keyword">forall</span> b r. <a href="Data-Data.html#t:Data">Data</a> b =&gt; c (b -&gt; r) -&gt; c r) -&gt; (<span class="keyword">forall</span> r.  r -&gt; c r) -&gt; <a href="Data-Data.html#t:Constr">Constr</a> -&gt; c a</li><li><a href="#v:toConstr">toConstr</a> :: a -&gt; <a href="Data-Data.html#t:Constr">Constr</a></li><li><a href="#v:dataTypeOf">dataTypeOf</a> :: a -&gt; <a href="Data-Data.html#t:DataType">DataType</a></li><li><a href="#v:dataCast1">dataCast1</a> :: <a href="Data-Typeable-Internal.html#t:Typeable1">Typeable1</a> t =&gt; (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; c (t d)) -&gt; <a href="Data-Maybe.html#t:Maybe">Maybe</a> (c a)</li><li><a href="#v:dataCast2">dataCast2</a> :: <a href="Data-Typeable-Internal.html#t:Typeable2">Typeable2</a> t =&gt; (<span class="keyword">forall</span> d e. (<a href="Data-Data.html#t:Data">Data</a> d, <a href="Data-Data.html#t:Data">Data</a> e) =&gt; c (t d e)) -&gt; <a href="Data-Maybe.html#t:Maybe">Maybe</a> (c a)</li><li><a href="#v:gmapT">gmapT</a> :: (<span class="keyword">forall</span> b. <a href="Data-Data.html#t:Data">Data</a> b =&gt; b -&gt; b) -&gt; a -&gt; a</li><li><a href="#v:gmapQl">gmapQl</a> :: <span class="keyword">forall</span> r r'.  (r -&gt; r' -&gt; r) -&gt; r -&gt; (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; r') -&gt; a -&gt; r</li><li><a href="#v:gmapQr">gmapQr</a> :: <span class="keyword">forall</span> r r'.  (r' -&gt; r -&gt; r) -&gt; r -&gt; (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; r') -&gt; a -&gt; r</li><li><a href="#v:gmapQ">gmapQ</a> ::  (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; u) -&gt; a -&gt; [u]</li><li><a href="#v:gmapQi">gmapQi</a> :: <span class="keyword">forall</span> u.  <a href="Data-Int.html#t:Int">Int</a> -&gt; (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; u) -&gt; a -&gt; u</li><li><a href="#v:gmapM">gmapM</a> :: <span class="keyword">forall</span> m. <a href="Control-Monad.html#t:Monad">Monad</a> m =&gt; (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; m d) -&gt; a -&gt; m a</li><li><a href="#v:gmapMp">gmapMp</a> :: <span class="keyword">forall</span> m. <a href="Control-Monad.html#t:MonadPlus">MonadPlus</a> m =&gt; (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; m d) -&gt; a -&gt; m a</li><li><a href="#v:gmapMo">gmapMo</a> :: <span class="keyword">forall</span> m. <a href="Control-Monad.html#t:MonadPlus">MonadPlus</a> m =&gt; (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; m d) -&gt; a -&gt; m a</li></ul></li><li class="src short"><span class="keyword">data</span>  <a href="#t:DataType">DataType</a> </li><li class="src short"><a href="#v:mkDataType">mkDataType</a> :: <a href="Data-String.html#t:String">String</a> -&gt; [<a href="Data-Data.html#t:Constr">Constr</a>] -&gt; <a href="Data-Data.html#t:DataType">DataType</a></li><li class="src short"><a href="#v:mkIntType">mkIntType</a> :: <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-Data.html#t:DataType">DataType</a></li><li class="src short"><a href="#v:mkFloatType">mkFloatType</a> :: <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-Data.html#t:DataType">DataType</a></li><li class="src short"><a href="#v:mkStringType">mkStringType</a> :: <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-Data.html#t:DataType">DataType</a></li><li class="src short"><a href="#v:mkCharType">mkCharType</a> :: <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-Data.html#t:DataType">DataType</a></li><li class="src short"><a href="#v:mkNoRepType">mkNoRepType</a> :: <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-Data.html#t:DataType">DataType</a></li><li class="src short"><a href="#v:mkNorepType">mkNorepType</a> :: <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-Data.html#t:DataType">DataType</a></li><li class="src short"><a href="#v:dataTypeName">dataTypeName</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-String.html#t:String">String</a></li><li class="src short"><span class="keyword">data</span>  <a href="#t:DataRep">DataRep</a> <ul class="subs"><li>= <a href="#v:AlgRep">AlgRep</a> [<a href="Data-Data.html#t:Constr">Constr</a>]  </li><li>| <a href="#v:IntRep">IntRep</a>  </li><li>| <a href="#v:FloatRep">FloatRep</a>  </li><li>| <a href="#v:CharRep">CharRep</a>  </li><li>| <a href="#v:NoRep">NoRep</a>  </li></ul></li><li class="src short"><a href="#v:dataTypeRep">dataTypeRep</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-Data.html#t:DataRep">DataRep</a></li><li class="src short"><a href="#v:repConstr">repConstr</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-Data.html#t:ConstrRep">ConstrRep</a> -&gt; <a href="Data-Data.html#t:Constr">Constr</a></li><li class="src short"><a href="#v:isAlgType">isAlgType</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:dataTypeConstrs">dataTypeConstrs</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; [<a href="Data-Data.html#t:Constr">Constr</a>]</li><li class="src short"><a href="#v:indexConstr">indexConstr</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-Data.html#t:ConIndex">ConIndex</a> -&gt; <a href="Data-Data.html#t:Constr">Constr</a></li><li class="src short"><a href="#v:maxConstrIndex">maxConstrIndex</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-Data.html#t:ConIndex">ConIndex</a></li><li class="src short"><a href="#v:isNorepType">isNorepType</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><span class="keyword">data</span>  <a href="#t:Constr">Constr</a> </li><li class="src short"><span class="keyword">type</span> <a href="#t:ConIndex">ConIndex</a> = <a href="Data-Int.html#t:Int">Int</a></li><li class="src short"><span class="keyword">data</span>  <a href="#t:Fixity">Fixity</a> <ul class="subs"><li>= <a href="#v:Prefix">Prefix</a>  </li><li>| <a href="#v:Infix">Infix</a>  </li></ul></li><li class="src short"><a href="#v:mkConstr">mkConstr</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-String.html#t:String">String</a> -&gt; [<a href="Data-String.html#t:String">String</a>] -&gt; <a href="Data-Data.html#t:Fixity">Fixity</a> -&gt; <a href="Data-Data.html#t:Constr">Constr</a></li><li class="src short"><a href="#v:mkIntConstr">mkIntConstr</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Prelude.html#t:Integer">Integer</a> -&gt; <a href="Data-Data.html#t:Constr">Constr</a></li><li class="src short"><a href="#v:mkFloatConstr">mkFloatConstr</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Prelude.html#t:Double">Double</a> -&gt; <a href="Data-Data.html#t:Constr">Constr</a></li><li class="src short"><a href="#v:mkIntegralConstr">mkIntegralConstr</a> :: (<a href="Prelude.html#t:Integral">Integral</a> a, <a href="Text-Show.html#t:Show">Show</a> a) =&gt; <a href="Data-Data.html#t:DataType">DataType</a> -&gt; a -&gt; <a href="Data-Data.html#t:Constr">Constr</a></li><li class="src short"><a href="#v:mkRealConstr">mkRealConstr</a> :: (<a href="Prelude.html#t:Real">Real</a> a, <a href="Text-Show.html#t:Show">Show</a> a) =&gt; <a href="Data-Data.html#t:DataType">DataType</a> -&gt; a -&gt; <a href="Data-Data.html#t:Constr">Constr</a></li><li class="src short"><a href="#v:mkStringConstr">mkStringConstr</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-Data.html#t:Constr">Constr</a></li><li class="src short"><a href="#v:mkCharConstr">mkCharConstr</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Data.html#t:Constr">Constr</a></li><li class="src short"><a href="#v:constrType">constrType</a> :: <a href="Data-Data.html#t:Constr">Constr</a> -&gt; <a href="Data-Data.html#t:DataType">DataType</a></li><li class="src short"><span class="keyword">data</span>  <a href="#t:ConstrRep">ConstrRep</a> <ul class="subs"><li>= <a href="#v:AlgConstr">AlgConstr</a> <a href="Data-Data.html#t:ConIndex">ConIndex</a>  </li><li>| <a href="#v:IntConstr">IntConstr</a> <a href="Prelude.html#t:Integer">Integer</a>  </li><li>| <a href="#v:FloatConstr">FloatConstr</a> <a href="Prelude.html#t:Rational">Rational</a>  </li><li>| <a href="#v:CharConstr">CharConstr</a> <a href="Data-Char.html#t:Char">Char</a>  </li></ul></li><li class="src short"><a href="#v:constrRep">constrRep</a> :: <a href="Data-Data.html#t:Constr">Constr</a> -&gt; <a href="Data-Data.html#t:ConstrRep">ConstrRep</a></li><li class="src short"><a href="#v:constrFields">constrFields</a> :: <a href="Data-Data.html#t:Constr">Constr</a> -&gt; [<a href="Data-String.html#t:String">String</a>]</li><li class="src short"><a href="#v:constrFixity">constrFixity</a> :: <a href="Data-Data.html#t:Constr">Constr</a> -&gt; <a href="Data-Data.html#t:Fixity">Fixity</a></li><li class="src short"><a href="#v:constrIndex">constrIndex</a> :: <a href="Data-Data.html#t:Constr">Constr</a> -&gt; <a href="Data-Data.html#t:ConIndex">ConIndex</a></li><li class="src short"><a href="#v:showConstr">showConstr</a> :: <a href="Data-Data.html#t:Constr">Constr</a> -&gt; <a href="Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:readConstr">readConstr</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Data.html#t:Constr">Constr</a></li><li class="src short"><a href="#v:tyconUQname">tyconUQname</a> :: <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:tyconModule">tyconModule</a> :: <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:fromConstr">fromConstr</a> :: <a href="Data-Data.html#t:Data">Data</a> a =&gt; <a href="Data-Data.html#t:Constr">Constr</a> -&gt; a</li><li class="src short"><a href="#v:fromConstrB">fromConstrB</a> :: <a href="Data-Data.html#t:Data">Data</a> a =&gt; (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; d) -&gt; <a href="Data-Data.html#t:Constr">Constr</a> -&gt; a</li><li class="src short"><a href="#v:fromConstrM">fromConstrM</a> :: <span class="keyword">forall</span> m a. (<a href="Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Data.html#t:Data">Data</a> a) =&gt; (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; m d) -&gt; <a href="Data-Data.html#t:Constr">Constr</a> -&gt; m a</li></ul></div><div id="interface"><h1 id="g:1">Module Data.Typeable re-exported for convenience
</h1><div class="top"><p class="src">module <a href="Data-Typeable.html">Data.Typeable</a></p></div><h1 id="g:2">The Data class for processing constructor applications
</h1><div class="top"><p class="src"><span class="keyword">class</span> <a href="Data-Typeable-Internal.html#t:Typeable">Typeable</a> a =&gt; <a name="t:Data" class="def">Data</a> a  <span class="keyword">where</span></p><div class="doc"><p>The <code><a href="Data-Data.html#t:Data">Data</a></code> class comprehends a fundamental primitive <code><a href="Data-Data.html#v:gfoldl">gfoldl</a></code> for
folding over constructor applications, say terms. This primitive can
be instantiated in several ways to map over the immediate subterms
of a term; see the <code>gmap</code> combinators later in this class.  Indeed, a
generic programmer does not necessarily need to use the ingenious gfoldl
primitive but rather the intuitive <code>gmap</code> combinators.  The <code><a href="Data-Data.html#v:gfoldl">gfoldl</a></code>
primitive is completed by means to query top-level constructors, to
turn constructor representations into proper terms, and to list all
possible datatype constructors.  This completion allows us to serve
generic programming scenarios like read, show, equality, term generation.
</p><p>The combinators <code><a href="Data-Data.html#v:gmapT">gmapT</a></code>, <code><a href="Data-Data.html#v:gmapQ">gmapQ</a></code>, <code><a href="Data-Data.html#v:gmapM">gmapM</a></code>, etc are all provided with
default definitions in terms of <code><a href="Data-Data.html#v:gfoldl">gfoldl</a></code>, leaving open the opportunity
to provide datatype-specific definitions.
(The inclusion of the <code>gmap</code> combinators as members of class <code><a href="Data-Data.html#t:Data">Data</a></code>
allows the programmer or the compiler to derive specialised, and maybe
more efficient code per datatype.  <em>Note</em>: <code><a href="Data-Data.html#v:gfoldl">gfoldl</a></code> is more higher-order
than the <code>gmap</code> combinators.  This is subject to ongoing benchmarking
experiments.  It might turn out that the <code>gmap</code> combinators will be
moved out of the class <code><a href="Data-Data.html#t:Data">Data</a></code>.)
</p><p>Conceptually, the definition of the <code>gmap</code> combinators in terms of the
primitive <code><a href="Data-Data.html#v:gfoldl">gfoldl</a></code> requires the identification of the <code><a href="Data-Data.html#v:gfoldl">gfoldl</a></code> function
arguments.  Technically, we also need to identify the type constructor
<code>c</code> for the construction of the result type from the folded term type.
</p><p>In the definition of <code>gmapQ</code><em>x</em> combinators, we use phantom type
constructors for the <code>c</code> in the type of <code><a href="Data-Data.html#v:gfoldl">gfoldl</a></code> because the result type
of a query does not involve the (polymorphic) type of the term argument.
In the definition of <code><a href="Data-Data.html#v:gmapQl">gmapQl</a></code> we simply use the plain constant type
constructor because <code><a href="Data-Data.html#v:gfoldl">gfoldl</a></code> is left-associative anyway and so it is
readily suited to fold a left-associative binary operation over the
immediate subterms.  In the definition of gmapQr, extra effort is
needed. We use a higher-order accumulation trick to mediate between
left-associative constructor application vs. right-associative binary
operation (e.g., <code>(:)</code>).  When the query is meant to compute a value
of type <code>r</code>, then the result type withing generic folding is <code>r -&gt; r</code>.
So the result of folding is a function to which we finally pass the
right unit.
</p><p>With the <code>-XDeriveDataTypeable</code> option, GHC can generate instances of the
<code><a href="Data-Data.html#t:Data">Data</a></code> class automatically.  For example, given the declaration
</p><pre> data T a b = C1 a b | C2 deriving (Typeable, Data)
</pre><p>GHC will generate an instance that is equivalent to
</p><pre> instance (Data a, Data b) =&gt; Data (T a b) where
     gfoldl k z (C1 a b) = z C1 `k` a `k` b
     gfoldl k z C2       = z C2

     gunfold k z c = case constrIndex c of
                         1 -&gt; k (k (z C1))
                         2 -&gt; z C2

     toConstr (C1 _ _) = con_C1
     toConstr C2       = con_C2

     dataTypeOf _ = ty_T

 con_C1 = mkConstr ty_T &quot;C1&quot; [] Prefix
 con_C2 = mkConstr ty_T &quot;C2&quot; [] Prefix
 ty_T   = mkDataType &quot;Module.T&quot; [con_C1, con_C2]
</pre><p>This is suitable for datatypes that are exported transparently.
</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:gfoldl" class="def">gfoldl</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<span class="keyword">forall</span> d b. <a href="Data-Data.html#t:Data">Data</a> d =&gt; c (d -&gt; b) -&gt; d -&gt; c b)</td><td class="doc"><p>defines how nonempty constructor applications are
 folded.  It takes the folded tail of the constructor
 application and its head, i.e., an immediate subterm,
 and combines them in some way.
</p></td></tr><tr><td class="src">-&gt; (<span class="keyword">forall</span> g.  g -&gt; c g)</td><td class="doc"><p>defines how the empty constructor application is
 folded, like the neutral / start element for list
 folding.
</p></td></tr><tr><td class="src">-&gt; a</td><td class="doc"><p>structure to be folded.
</p></td></tr><tr><td class="src">-&gt; c a</td><td class="doc"><p>result, with a type defined in terms of <code>a</code>, but
 variability is achieved by means of type constructor
 <code>c</code> for the construction of the actual result type.
</p></td></tr></table></div><div class="doc"><p>Left-associative fold operation for constructor applications.
</p><p>The type of <code><a href="Data-Data.html#v:gfoldl">gfoldl</a></code> is a headache, but operationally it is a simple
 generalisation of a list fold.
</p><p>The default definition for <code><a href="Data-Data.html#v:gfoldl">gfoldl</a></code> is <code><code><a href="Prelude.html#v:const">const</a></code> <code><a href="Prelude.html#v:id">id</a></code></code>, which is
 suitable for abstract datatypes with no substructures.
</p></div><p class="src"><a name="v:gunfold" class="def">gunfold</a> ::  (<span class="keyword">forall</span> b r. <a href="Data-Data.html#t:Data">Data</a> b =&gt; c (b -&gt; r) -&gt; c r) -&gt; (<span class="keyword">forall</span> r.  r -&gt; c r) -&gt; <a href="Data-Data.html#t:Constr">Constr</a> -&gt; c a</p><div class="doc"><p>Unfolding constructor applications
</p></div><p class="src"><a name="v:toConstr" class="def">toConstr</a> :: a -&gt; <a href="Data-Data.html#t:Constr">Constr</a></p><div class="doc"><p>Obtaining the constructor from a given datum.
 For proper terms, this is meant to be the top-level constructor.
 Primitive datatypes are here viewed as potentially infinite sets of
 values (i.e., constructors).
</p></div><p class="src"><a name="v:dataTypeOf" class="def">dataTypeOf</a> :: a -&gt; <a href="Data-Data.html#t:DataType">DataType</a></p><div class="doc"><p>The outer type constructor of the type
</p></div><p class="src"><a name="v:dataCast1" class="def">dataCast1</a> :: <a href="Data-Typeable-Internal.html#t:Typeable1">Typeable1</a> t =&gt; (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; c (t d)) -&gt; <a href="Data-Maybe.html#t:Maybe">Maybe</a> (c a)</p><div class="doc"><p>Mediate types and unary type constructors.
 In <code><a href="Data-Data.html#t:Data">Data</a></code> instances of the form <code>T a</code>, <code><a href="Data-Data.html#v:dataCast1">dataCast1</a></code> should be defined
 as <code><a href="Data-Typeable.html#v:gcast1">gcast1</a></code>.
</p><p>The default definition is <code><code><a href="Prelude.html#v:const">const</a></code> <code><a href="Data-Maybe.html#v:Nothing">Nothing</a></code></code>, which is appropriate
 for non-unary type constructors.
</p></div><p class="src"><a name="v:dataCast2" class="def">dataCast2</a> :: <a href="Data-Typeable-Internal.html#t:Typeable2">Typeable2</a> t =&gt; (<span class="keyword">forall</span> d e. (<a href="Data-Data.html#t:Data">Data</a> d, <a href="Data-Data.html#t:Data">Data</a> e) =&gt; c (t d e)) -&gt; <a href="Data-Maybe.html#t:Maybe">Maybe</a> (c a)</p><div class="doc"><p>Mediate types and binary type constructors.
 In <code><a href="Data-Data.html#t:Data">Data</a></code> instances of the form <code>T a b</code>, <code><a href="Data-Data.html#v:dataCast2">dataCast2</a></code> should be
 defined as <code><a href="Data-Typeable.html#v:gcast2">gcast2</a></code>.
</p><p>The default definition is <code><code><a href="Prelude.html#v:const">const</a></code> <code><a href="Data-Maybe.html#v:Nothing">Nothing</a></code></code>, which is appropriate
 for non-binary type constructors.
</p></div><p class="src"><a name="v:gmapT" class="def">gmapT</a> :: (<span class="keyword">forall</span> b. <a href="Data-Data.html#t:Data">Data</a> b =&gt; b -&gt; b) -&gt; a -&gt; a</p><div class="doc"><p>A generic transformation that maps over the immediate subterms
</p><p>The default definition instantiates the type constructor <code>c</code> in the
 type of <code><a href="Data-Data.html#v:gfoldl">gfoldl</a></code> to an identity datatype constructor, using the
 isomorphism pair as injection and projection.
</p></div><p class="src"><a name="v:gmapQl" class="def">gmapQl</a> :: <span class="keyword">forall</span> r r'.  (r -&gt; r' -&gt; r) -&gt; r -&gt; (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; r') -&gt; a -&gt; r</p><div class="doc"><p>A generic query with a left-associative binary operator
</p></div><p class="src"><a name="v:gmapQr" class="def">gmapQr</a> :: <span class="keyword">forall</span> r r'.  (r' -&gt; r -&gt; r) -&gt; r -&gt; (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; r') -&gt; a -&gt; r</p><div class="doc"><p>A generic query with a right-associative binary operator
</p></div><p class="src"><a name="v:gmapQ" class="def">gmapQ</a> ::  (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; u) -&gt; a -&gt; [u]</p><div class="doc"><p>A generic query that processes the immediate subterms and returns a list
 of results.  The list is given in the same order as originally specified
 in the declaratoin of the data constructors.
</p></div><p class="src"><a name="v:gmapQi" class="def">gmapQi</a> :: <span class="keyword">forall</span> u.  <a href="Data-Int.html#t:Int">Int</a> -&gt; (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; u) -&gt; a -&gt; u</p><div class="doc"><p>A generic query that processes one child by index (zero-based)
</p></div><p class="src"><a name="v:gmapM" class="def">gmapM</a> :: <span class="keyword">forall</span> m. <a href="Control-Monad.html#t:Monad">Monad</a> m =&gt; (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; m d) -&gt; a -&gt; m a</p><div class="doc"><p>A generic monadic transformation that maps over the immediate subterms
</p><p>The default definition instantiates the type constructor <code>c</code> in
 the type of <code><a href="Data-Data.html#v:gfoldl">gfoldl</a></code> to the monad datatype constructor, defining
 injection and projection using <code><a href="Control-Monad.html#v:return">return</a></code> and <code><a href="Control-Monad.html#v:-62--62--61-">&gt;&gt;=</a></code>.
</p></div><p class="src"><a name="v:gmapMp" class="def">gmapMp</a> :: <span class="keyword">forall</span> m. <a href="Control-Monad.html#t:MonadPlus">MonadPlus</a> m =&gt; (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; m d) -&gt; a -&gt; m a</p><div class="doc"><p>Transformation of at least one immediate subterm does not fail
</p></div><p class="src"><a name="v:gmapMo" class="def">gmapMo</a> :: <span class="keyword">forall</span> m. <a href="Control-Monad.html#t:MonadPlus">MonadPlus</a> m =&gt; (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; m d) -&gt; a -&gt; m a</p><div class="doc"><p>Transformation of one immediate subterm with success
</p></div></div><div class="subs instances"><p id="control.i:Data" class="caption collapser" onclick="toggleSection('i:Data')">Instances</p><div id="section.i:Data" class="show"><table><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> <a href="Data-Bool.html#t:Bool">Bool</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> <a href="Data-Char.html#t:Char">Char</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> <a href="Prelude.html#t:Double">Double</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> <a href="Prelude.html#t:Float">Float</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> <a href="Data-Int.html#t:Int">Int</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> <a href="Data-Int.html#t:Int8">Int8</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> <a href="Data-Int.html#t:Int16">Int16</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> <a href="Data-Int.html#t:Int32">Int32</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> <a href="Data-Int.html#t:Int64">Int64</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> <a href="Prelude.html#t:Integer">Integer</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> <a href="Data-Ord.html#t:Ordering">Ordering</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> <a href="Data-Word.html#t:Word">Word</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> <a href="Data-Word.html#t:Word8">Word8</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> <a href="Data-Word.html#t:Word16">Word16</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> <a href="Data-Word.html#t:Word32">Word32</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> <a href="Data-Word.html#t:Word64">Word64</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> ()</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> <a href="GHC-Exts.html#t:SpecConstrAnnotation">SpecConstrAnnotation</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> a =&gt; <a href="Data-Data.html#t:Data">Data</a> [a]</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Data-Data.html#t:Data">Data</a> a, <a href="Prelude.html#t:Integral">Integral</a> a) =&gt; <a href="Data-Data.html#t:Data">Data</a> (<a href="Data-Ratio.html#t:Ratio">Ratio</a> a)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Typeable-Internal.html#t:Typeable">Typeable</a> a =&gt; <a href="Data-Data.html#t:Data">Data</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> a =&gt; <a href="Data-Data.html#t:Data">Data</a> (<a href="Data-Maybe.html#t:Maybe">Maybe</a> a)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Typeable-Internal.html#t:Typeable">Typeable</a> a =&gt; <a href="Data-Data.html#t:Data">Data</a> (<a href="Foreign-ForeignPtr-Safe.html#t:ForeignPtr">ForeignPtr</a> a)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Data.html#t:Data">Data</a> a =&gt; <a href="Data-Data.html#t:Data">Data</a> (<a href="Data-Complex.html#t:Complex">Complex</a> a)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Typeable-Internal.html#t:Typeable">Typeable</a> a =&gt; <a href="Data-Data.html#t:Data">Data</a> (<a href="Data-Fixed.html#t:Fixed">Fixed</a> a)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Data-Data.html#t:Data">Data</a> a, <a href="Data-Data.html#t:Data">Data</a> b) =&gt; <a href="Data-Data.html#t:Data">Data</a> (<a href="Data-Either.html#t:Either">Either</a> a b)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Data-Data.html#t:Data">Data</a> a, <a href="Data-Data.html#t:Data">Data</a> b) =&gt; <a href="Data-Data.html#t:Data">Data</a> (a, b)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Data-Typeable-Internal.html#t:Typeable">Typeable</a> a, <a href="Data-Data.html#t:Data">Data</a> b, <a href="Data-Ix.html#t:Ix">Ix</a> a) =&gt; <a href="Data-Data.html#t:Data">Data</a> (Array a b)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Data-Data.html#t:Data">Data</a> a, <a href="Data-Data.html#t:Data">Data</a> b, <a href="Data-Data.html#t:Data">Data</a> c) =&gt; <a href="Data-Data.html#t:Data">Data</a> (a, b, c)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Data-Data.html#t:Data">Data</a> a, <a href="Data-Data.html#t:Data">Data</a> b, <a href="Data-Data.html#t:Data">Data</a> c, <a href="Data-Data.html#t:Data">Data</a> d) =&gt; <a href="Data-Data.html#t:Data">Data</a> (a, b, c, d)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Data-Data.html#t:Data">Data</a> a, <a href="Data-Data.html#t:Data">Data</a> b, <a href="Data-Data.html#t:Data">Data</a> c, <a href="Data-Data.html#t:Data">Data</a> d, <a href="Data-Data.html#t:Data">Data</a> e) =&gt; <a href="Data-Data.html#t:Data">Data</a> (a, b, c, d, e)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Data-Data.html#t:Data">Data</a> a, <a href="Data-Data.html#t:Data">Data</a> b, <a href="Data-Data.html#t:Data">Data</a> c, <a href="Data-Data.html#t:Data">Data</a> d, <a href="Data-Data.html#t:Data">Data</a> e, <a href="Data-Data.html#t:Data">Data</a> f) =&gt; <a href="Data-Data.html#t:Data">Data</a> (a, b, c, d, e, f)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Data-Data.html#t:Data">Data</a> a, <a href="Data-Data.html#t:Data">Data</a> b, <a href="Data-Data.html#t:Data">Data</a> c, <a href="Data-Data.html#t:Data">Data</a> d, <a href="Data-Data.html#t:Data">Data</a> e, <a href="Data-Data.html#t:Data">Data</a> f, <a href="Data-Data.html#t:Data">Data</a> g) =&gt; <a href="Data-Data.html#t:Data">Data</a> (a, b, c, d, e, f, g)</td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><h1 id="g:3">Datatype representations
</h1><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:DataType" class="def">DataType</a>  </p><div class="doc"><p>Representation of datatypes.
 A package of constructor representations with names of type and module.
</p></div><div class="subs instances"><p id="control.i:DataType" class="caption collapser" onclick="toggleSection('i:DataType')">Instances</p><div id="section.i:DataType" class="show"><table><tr><td class="src"><a href="Text-Show.html#t:Show">Show</a> <a href="Data-Data.html#t:DataType">DataType</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><h2 id="g:4">Constructors
</h2><div class="top"><p class="src"><a name="v:mkDataType" class="def">mkDataType</a> :: <a href="Data-String.html#t:String">String</a> -&gt; [<a href="Data-Data.html#t:Constr">Constr</a>] -&gt; <a href="Data-Data.html#t:DataType">DataType</a></p><div class="doc"><p>Constructs an algebraic datatype
</p></div></div><div class="top"><p class="src"><a name="v:mkIntType" class="def">mkIntType</a> :: <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-Data.html#t:DataType">DataType</a></p><div class="doc"><p>Constructs the <code><a href="Data-Int.html#t:Int">Int</a></code> type
</p></div></div><div class="top"><p class="src"><a name="v:mkFloatType" class="def">mkFloatType</a> :: <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-Data.html#t:DataType">DataType</a></p><div class="doc"><p>Constructs the <code><a href="Prelude.html#t:Float">Float</a></code> type
</p></div></div><div class="top"><p class="src"><a name="v:mkStringType" class="def">mkStringType</a> :: <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-Data.html#t:DataType">DataType</a></p><div class="doc"><div class="warning"><p>Deprecated: Use mkCharType instead</p></div><p>This function is now deprecated. Please use <code><a href="Data-Data.html#v:mkCharType">mkCharType</a></code> instead.
</p></div></div><div class="top"><p class="src"><a name="v:mkCharType" class="def">mkCharType</a> :: <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-Data.html#t:DataType">DataType</a></p><div class="doc"><p>Constructs the <code><a href="Data-Char.html#t:Char">Char</a></code> type
</p></div></div><div class="top"><p class="src"><a name="v:mkNoRepType" class="def">mkNoRepType</a> :: <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-Data.html#t:DataType">DataType</a></p><div class="doc"><p>Constructs a non-representation for a non-presentable type
</p></div></div><div class="top"><p class="src"><a name="v:mkNorepType" class="def">mkNorepType</a> :: <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-Data.html#t:DataType">DataType</a></p><div class="doc"><div class="warning"><p>Deprecated: Use mkNoRepType instead</p></div><p>Deprecated version (misnamed)
</p></div></div><h2 id="g:5">Observers
</h2><div class="top"><p class="src"><a name="v:dataTypeName" class="def">dataTypeName</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-String.html#t:String">String</a></p><div class="doc"><p>Gets the type constructor including the module
</p></div></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:DataRep" class="def">DataRep</a>  </p><div class="doc"><p>Public representation of datatypes
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:AlgRep" class="def">AlgRep</a> [<a href="Data-Data.html#t:Constr">Constr</a>]</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:IntRep" class="def">IntRep</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:FloatRep" class="def">FloatRep</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:CharRep" class="def">CharRep</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:NoRep" class="def">NoRep</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="subs instances"><p id="control.i:DataRep" class="caption collapser" onclick="toggleSection('i:DataRep')">Instances</p><div id="section.i:DataRep" class="show"><table><tr><td class="src"><a href="Data-Eq.html#t:Eq">Eq</a> <a href="Data-Data.html#t:DataRep">DataRep</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Text-Show.html#t:Show">Show</a> <a href="Data-Data.html#t:DataRep">DataRep</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:dataTypeRep" class="def">dataTypeRep</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-Data.html#t:DataRep">DataRep</a></p><div class="doc"><p>Gets the public presentation of a datatype
</p></div></div><h2 id="g:6">Convenience functions
</h2><div class="top"><p class="src"><a name="v:repConstr" class="def">repConstr</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-Data.html#t:ConstrRep">ConstrRep</a> -&gt; <a href="Data-Data.html#t:Constr">Constr</a></p><div class="doc"><p>Look up a constructor by its representation
</p></div></div><div class="top"><p class="src"><a name="v:isAlgType" class="def">isAlgType</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>Test for an algebraic type
</p></div></div><div class="top"><p class="src"><a name="v:dataTypeConstrs" class="def">dataTypeConstrs</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; [<a href="Data-Data.html#t:Constr">Constr</a>]</p><div class="doc"><p>Gets the constructors of an algebraic datatype
</p></div></div><div class="top"><p class="src"><a name="v:indexConstr" class="def">indexConstr</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-Data.html#t:ConIndex">ConIndex</a> -&gt; <a href="Data-Data.html#t:Constr">Constr</a></p><div class="doc"><p>Gets the constructor for an index (algebraic datatypes only)
</p></div></div><div class="top"><p class="src"><a name="v:maxConstrIndex" class="def">maxConstrIndex</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-Data.html#t:ConIndex">ConIndex</a></p><div class="doc"><p>Gets the maximum constructor index of an algebraic datatype
</p></div></div><div class="top"><p class="src"><a name="v:isNorepType" class="def">isNorepType</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>Test for a non-representable type
</p></div></div><h1 id="g:7">Data constructor representations
</h1><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:Constr" class="def">Constr</a>  </p><div class="doc"><p>Representation of constructors. Note that equality on constructors
 with different types may not work -- i.e. the constructors for <code><a href="Data-Bool.html#v:False">False</a></code> and
 <code><a href="Data-Maybe.html#v:Nothing">Nothing</a></code> may compare equal.
</p></div><div class="subs instances"><p id="control.i:Constr" class="caption collapser" onclick="toggleSection('i:Constr')">Instances</p><div id="section.i:Constr" class="show"><table><tr><td class="src"><a href="Data-Eq.html#t:Eq">Eq</a> <a href="Data-Data.html#t:Constr">Constr</a></td><td class="doc"><p>Equality of constructors
</p></td></tr><tr><td class="src"><a href="Text-Show.html#t:Show">Show</a> <a href="Data-Data.html#t:Constr">Constr</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:ConIndex" class="def">ConIndex</a> = <a href="Data-Int.html#t:Int">Int</a></p><div class="doc"><p>Unique index for datatype constructors,
 counting from 1 in the order they are given in the program text.
</p></div></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:Fixity" class="def">Fixity</a>  </p><div class="doc"><p>Fixity of constructors
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:Prefix" class="def">Prefix</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:Infix" class="def">Infix</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="subs instances"><p id="control.i:Fixity" class="caption collapser" onclick="toggleSection('i:Fixity')">Instances</p><div id="section.i:Fixity" class="show"><table><tr><td class="src"><a href="Data-Eq.html#t:Eq">Eq</a> <a href="Data-Data.html#t:Fixity">Fixity</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Text-Show.html#t:Show">Show</a> <a href="Data-Data.html#t:Fixity">Fixity</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><h2 id="g:8">Constructors
</h2><div class="top"><p class="src"><a name="v:mkConstr" class="def">mkConstr</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-String.html#t:String">String</a> -&gt; [<a href="Data-String.html#t:String">String</a>] -&gt; <a href="Data-Data.html#t:Fixity">Fixity</a> -&gt; <a href="Data-Data.html#t:Constr">Constr</a></p><div class="doc"><p>Constructs a constructor
</p></div></div><div class="top"><p class="src"><a name="v:mkIntConstr" class="def">mkIntConstr</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Prelude.html#t:Integer">Integer</a> -&gt; <a href="Data-Data.html#t:Constr">Constr</a></p><div class="doc"><div class="warning"><p>Deprecated: Use mkIntegralConstr instead</p></div><p>This function is now deprecated. Please use <code><a href="Data-Data.html#v:mkIntegralConstr">mkIntegralConstr</a></code> instead.
</p></div></div><div class="top"><p class="src"><a name="v:mkFloatConstr" class="def">mkFloatConstr</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Prelude.html#t:Double">Double</a> -&gt; <a href="Data-Data.html#t:Constr">Constr</a></p><div class="doc"><div class="warning"><p>Deprecated: Use mkRealConstr instead</p></div><p>This function is now deprecated. Please use <code><a href="Data-Data.html#v:mkRealConstr">mkRealConstr</a></code> instead.
</p></div></div><div class="top"><p class="src"><a name="v:mkIntegralConstr" class="def">mkIntegralConstr</a> :: (<a href="Prelude.html#t:Integral">Integral</a> a, <a href="Text-Show.html#t:Show">Show</a> a) =&gt; <a href="Data-Data.html#t:DataType">DataType</a> -&gt; a -&gt; <a href="Data-Data.html#t:Constr">Constr</a></p></div><div class="top"><p class="src"><a name="v:mkRealConstr" class="def">mkRealConstr</a> :: (<a href="Prelude.html#t:Real">Real</a> a, <a href="Text-Show.html#t:Show">Show</a> a) =&gt; <a href="Data-Data.html#t:DataType">DataType</a> -&gt; a -&gt; <a href="Data-Data.html#t:Constr">Constr</a></p></div><div class="top"><p class="src"><a name="v:mkStringConstr" class="def">mkStringConstr</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-Data.html#t:Constr">Constr</a></p><div class="doc"><div class="warning"><p>Deprecated: Use mkCharConstr instead</p></div><p>This function is now deprecated. Please use <code><a href="Data-Data.html#v:mkCharConstr">mkCharConstr</a></code> instead.
</p></div></div><div class="top"><p class="src"><a name="v:mkCharConstr" class="def">mkCharConstr</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Data.html#t:Constr">Constr</a></p><div class="doc"><p>Makes a constructor for <code><a href="Data-Char.html#t:Char">Char</a></code>.
</p></div></div><h2 id="g:9">Observers
</h2><div class="top"><p class="src"><a name="v:constrType" class="def">constrType</a> :: <a href="Data-Data.html#t:Constr">Constr</a> -&gt; <a href="Data-Data.html#t:DataType">DataType</a></p><div class="doc"><p>Gets the datatype of a constructor
</p></div></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:ConstrRep" class="def">ConstrRep</a>  </p><div class="doc"><p>Public representation of constructors
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:AlgConstr" class="def">AlgConstr</a> <a href="Data-Data.html#t:ConIndex">ConIndex</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:IntConstr" class="def">IntConstr</a> <a href="Prelude.html#t:Integer">Integer</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:FloatConstr" class="def">FloatConstr</a> <a href="Prelude.html#t:Rational">Rational</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:CharConstr" class="def">CharConstr</a> <a href="Data-Char.html#t:Char">Char</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="subs instances"><p id="control.i:ConstrRep" class="caption collapser" onclick="toggleSection('i:ConstrRep')">Instances</p><div id="section.i:ConstrRep" class="show"><table><tr><td class="src"><a href="Data-Eq.html#t:Eq">Eq</a> <a href="Data-Data.html#t:ConstrRep">ConstrRep</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Text-Show.html#t:Show">Show</a> <a href="Data-Data.html#t:ConstrRep">ConstrRep</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:constrRep" class="def">constrRep</a> :: <a href="Data-Data.html#t:Constr">Constr</a> -&gt; <a href="Data-Data.html#t:ConstrRep">ConstrRep</a></p><div class="doc"><p>Gets the public presentation of constructors
</p></div></div><div class="top"><p class="src"><a name="v:constrFields" class="def">constrFields</a> :: <a href="Data-Data.html#t:Constr">Constr</a> -&gt; [<a href="Data-String.html#t:String">String</a>]</p><div class="doc"><p>Gets the field labels of a constructor.  The list of labels
 is returned in the same order as they were given in the original 
 constructor declaration.
</p></div></div><div class="top"><p class="src"><a name="v:constrFixity" class="def">constrFixity</a> :: <a href="Data-Data.html#t:Constr">Constr</a> -&gt; <a href="Data-Data.html#t:Fixity">Fixity</a></p><div class="doc"><p>Gets the fixity of a constructor
</p></div></div><h2 id="g:10">Convenience function: algebraic data types
</h2><div class="top"><p class="src"><a name="v:constrIndex" class="def">constrIndex</a> :: <a href="Data-Data.html#t:Constr">Constr</a> -&gt; <a href="Data-Data.html#t:ConIndex">ConIndex</a></p><div class="doc"><p>Gets the index of a constructor (algebraic datatypes only)
</p></div></div><h2 id="g:11">From strings to constructors and vice versa: all data types
</h2><div class="top"><p class="src"><a name="v:showConstr" class="def">showConstr</a> :: <a href="Data-Data.html#t:Constr">Constr</a> -&gt; <a href="Data-String.html#t:String">String</a></p><div class="doc"><p>Gets the string for a constructor
</p></div></div><div class="top"><p class="src"><a name="v:readConstr" class="def">readConstr</a> :: <a href="Data-Data.html#t:DataType">DataType</a> -&gt; <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Data.html#t:Constr">Constr</a></p><div class="doc"><p>Lookup a constructor via a string
</p></div></div><h1 id="g:12">Convenience functions: take type constructors apart
</h1><div class="top"><p class="src"><a name="v:tyconUQname" class="def">tyconUQname</a> :: <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-String.html#t:String">String</a></p><div class="doc"><p>Gets the unqualified type constructor:
 drop *.*.*... before name
</p></div></div><div class="top"><p class="src"><a name="v:tyconModule" class="def">tyconModule</a> :: <a href="Data-String.html#t:String">String</a> -&gt; <a href="Data-String.html#t:String">String</a></p><div class="doc"><p>Gets the module of a type constructor:
 take *.*.*... before name
</p></div></div><h1 id="g:13">Generic operations defined in terms of <code><a href="Data-Data.html#v:gunfold">gunfold</a></code>
</h1><div class="top"><p class="src"><a name="v:fromConstr" class="def">fromConstr</a> :: <a href="Data-Data.html#t:Data">Data</a> a =&gt; <a href="Data-Data.html#t:Constr">Constr</a> -&gt; a</p><div class="doc"><p>Build a term skeleton
</p></div></div><div class="top"><p class="src"><a name="v:fromConstrB" class="def">fromConstrB</a> :: <a href="Data-Data.html#t:Data">Data</a> a =&gt; (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; d) -&gt; <a href="Data-Data.html#t:Constr">Constr</a> -&gt; a</p><div class="doc"><p>Build a term and use a generic function for subterms
</p></div></div><div class="top"><p class="src"><a name="v:fromConstrM" class="def">fromConstrM</a> :: <span class="keyword">forall</span> m a. (<a href="Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Data.html#t:Data">Data</a> a) =&gt; (<span class="keyword">forall</span> d. <a href="Data-Data.html#t:Data">Data</a> d =&gt; m d) -&gt; <a href="Data-Data.html#t:Constr">Constr</a> -&gt; m a</p><div class="doc"><p>Monadic variation on <code><a href="Data-Data.html#v:fromConstrB">fromConstrB</a></code>
</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.11.0</p></div></body></html>