<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--Rendered using the Haskell Html Library v0.2--> <HTML ><HEAD ><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" ><TITLE >Data.Data</TITLE ><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" ><SCRIPT SRC="haddock-util.js" TYPE="text/javascript" ></SCRIPT ><SCRIPT TYPE="text/javascript" >window.onload = function () {setSynopsis("mini_Data-Data.html")};</SCRIPT ></HEAD ><BODY ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="topbar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " ></TD ><TD CLASS="title" >base-4.1.0.0: Basic libraries</TD ><TD CLASS="topbut" ><A HREF="index.html" >Contents</A ></TD ><TD CLASS="topbut" ><A HREF="doc-index.html" >Index</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="modulebar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><FONT SIZE="6" >Data.Data</FONT ></TD ><TD ALIGN="right" ><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="infohead" >Portability</TD ><TD CLASS="infoval" >non-portable (local universal quantification)</TD ></TR ><TR ><TD CLASS="infohead" >Stability</TD ><TD CLASS="infoval" >experimental</TD ></TR ><TR ><TD CLASS="infohead" >Maintainer</TD ><TD CLASS="infoval" >libraries@haskell.org</TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="section4" ><B >Contents</B ></TD ></TR ><TR ><TD ><DL ><DT ><A HREF="#1" >Module Data.Typeable re-exported for convenience </A ></DT ><DT ><A HREF="#2" >The Data class for processing constructor applications </A ></DT ><DT ><A HREF="#3" >Datatype representations </A ></DT ><DD ><DL ><DT ><A HREF="#4" >Constructors </A ></DT ><DT ><A HREF="#5" >Observers </A ></DT ><DT ><A HREF="#6" >Convenience functions </A ></DT ></DL ></DD ><DT ><A HREF="#7" >Data constructor representations </A ></DT ><DD ><DL ><DT ><A HREF="#8" >Constructors </A ></DT ><DT ><A HREF="#9" >Observers </A ></DT ><DT ><A HREF="#10" >Convenience function: algebraic data types </A ></DT ><DT ><A HREF="#11" >From strings to constructors and vice versa: all data types </A ></DT ></DL ></DD ><DT ><A HREF="#12" >Convenience functions: take type constructors apart </A ></DT ><DT ><A HREF="#13" >Generic operations defined in terms of <TT ><A HREF="Data-Data.html#v%3Agunfold" >gunfold</A ></TT > </A ></DT ></DL ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Description</TD ></TR ><TR ><TD CLASS="doc" ><P >"Scrap your boilerplate" --- Generic programming in Haskell. See <A HREF="http://www.cs.vu.nl/boilerplate/" >http://www.cs.vu.nl/boilerplate/</A >. This module provides the <TT ><A HREF="Data-Data.html#t%3AData" >Data</A ></TT > 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 <TT >Data.Generics.Instances</TT > module in the <TT >syb</TT > 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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Synopsis</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" >module <A HREF="Data-Typeable.html" >Data.Typeable</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >class</SPAN > <A HREF="Data-Typeable.html#t%3ATypeable" >Typeable</A > a => <A HREF="#t%3AData" >Data</A > a <SPAN CLASS="keyword" >where</SPAN ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="#v%3Agfoldl" >gfoldl</A > :: (<SPAN CLASS="keyword" >forall</SPAN > d b. <A HREF="Data-Data.html#t%3AData" >Data</A > d => c (d -> b) -> d -> c b) -> (<SPAN CLASS="keyword" >forall</SPAN > g. g -> c g) -> a -> c a</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Agunfold" >gunfold</A > :: (<SPAN CLASS="keyword" >forall</SPAN > b r. <A HREF="Data-Data.html#t%3AData" >Data</A > b => c (b -> r) -> c r) -> (<SPAN CLASS="keyword" >forall</SPAN > r. r -> c r) -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> c a</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AtoConstr" >toConstr</A > :: a -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AdataTypeOf" >dataTypeOf</A > :: a -> <A HREF="Data-Data.html#t%3ADataType" >DataType</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AdataCast1" >dataCast1</A > :: <A HREF="Data-Typeable.html#t%3ATypeable1" >Typeable1</A > t => (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => c (t d)) -> <A HREF="Data-Maybe.html#t%3AMaybe" >Maybe</A > (c a)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AdataCast2" >dataCast2</A > :: <A HREF="Data-Typeable.html#t%3ATypeable2" >Typeable2</A > t => (<SPAN CLASS="keyword" >forall</SPAN > d e. (<A HREF="Data-Data.html#t%3AData" >Data</A > d, <A HREF="Data-Data.html#t%3AData" >Data</A > e) => c (t d e)) -> <A HREF="Data-Maybe.html#t%3AMaybe" >Maybe</A > (c a)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AgmapT" >gmapT</A > :: (<SPAN CLASS="keyword" >forall</SPAN > b. <A HREF="Data-Data.html#t%3AData" >Data</A > b => b -> b) -> a -> a</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AgmapQl" >gmapQl</A > :: (r -> r' -> r) -> r -> (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => d -> r') -> a -> r</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AgmapQr" >gmapQr</A > :: (r' -> r -> r) -> r -> (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => d -> r') -> a -> r</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AgmapQ" >gmapQ</A > :: (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => d -> u) -> a -> [u]</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AgmapQi" >gmapQi</A > :: <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => d -> u) -> a -> u</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AgmapM" >gmapM</A > :: <A HREF="Control-Monad.html#t%3AMonad" >Monad</A > m => (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => d -> m d) -> a -> m a</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AgmapMp" >gmapMp</A > :: <A HREF="Control-Monad.html#t%3AMonadPlus" >MonadPlus</A > m => (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => d -> m d) -> a -> m a</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AgmapMo" >gmapMo</A > :: <A HREF="Control-Monad.html#t%3AMonadPlus" >MonadPlus</A > m => (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => d -> m d) -> a -> m a</TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A HREF="#t%3ADataType" >DataType</A > </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkDataType" >mkDataType</A > :: <A HREF="Data-Char.html#t%3AString" >String</A > -> [<A HREF="Data-Data.html#t%3AConstr" >Constr</A >] -> <A HREF="Data-Data.html#t%3ADataType" >DataType</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkIntType" >mkIntType</A > :: <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Data.html#t%3ADataType" >DataType</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkFloatType" >mkFloatType</A > :: <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Data.html#t%3ADataType" >DataType</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkStringType" >mkStringType</A > :: <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Data.html#t%3ADataType" >DataType</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkNorepType" >mkNorepType</A > :: <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Data.html#t%3ADataType" >DataType</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AdataTypeName" >dataTypeName</A > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="Data-Char.html#t%3AString" >String</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A HREF="#t%3ADataRep" >DataRep</A > </TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" >= <A HREF="#v%3AAlgRep" >AlgRep</A > [<A HREF="Data-Data.html#t%3AConstr" >Constr</A >]</TD ></TR ><TR ><TD CLASS="decl" >| <A HREF="#v%3AIntRep" >IntRep</A ></TD ></TR ><TR ><TD CLASS="decl" >| <A HREF="#v%3AFloatRep" >FloatRep</A ></TD ></TR ><TR ><TD CLASS="decl" >| <A HREF="#v%3AStringRep" >StringRep</A ></TD ></TR ><TR ><TD CLASS="decl" >| <A HREF="#v%3ANoRep" >NoRep</A ></TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AdataTypeRep" >dataTypeRep</A > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="Data-Data.html#t%3ADataRep" >DataRep</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3ArepConstr" >repConstr</A > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="Data-Data.html#t%3AConstrRep" >ConstrRep</A > -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisAlgType" >isAlgType</A > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AdataTypeConstrs" >dataTypeConstrs</A > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> [<A HREF="Data-Data.html#t%3AConstr" >Constr</A >]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AindexConstr" >indexConstr</A > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="Data-Data.html#t%3AConIndex" >ConIndex</A > -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmaxConstrIndex" >maxConstrIndex</A > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="Data-Data.html#t%3AConIndex" >ConIndex</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisNorepType" >isNorepType</A > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A HREF="#t%3AConstr" >Constr</A > </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >type</SPAN > <A HREF="#t%3AConIndex" >ConIndex</A > = <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A HREF="#t%3AFixity" >Fixity</A > </TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" >= <A HREF="#v%3APrefix" >Prefix</A ></TD ></TR ><TR ><TD CLASS="decl" >| <A HREF="#v%3AInfix" >Infix</A ></TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkConstr" >mkConstr</A > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="Data-Char.html#t%3AString" >String</A > -> [<A HREF="Data-Char.html#t%3AString" >String</A >] -> <A HREF="Data-Data.html#t%3AFixity" >Fixity</A > -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkIntConstr" >mkIntConstr</A > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="../integer/GHC-Integer.html#t%3AInteger" >Integer</A > -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkFloatConstr" >mkFloatConstr</A > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="../ghc-prim/GHC-Types.html#t%3ADouble" >Double</A > -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkStringConstr" >mkStringConstr</A > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AconstrType" >constrType</A > :: <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> <A HREF="Data-Data.html#t%3ADataType" >DataType</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A HREF="#t%3AConstrRep" >ConstrRep</A > </TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" >= <A HREF="#v%3AAlgConstr" >AlgConstr</A > <A HREF="Data-Data.html#t%3AConIndex" >ConIndex</A ></TD ></TR ><TR ><TD CLASS="decl" >| <A HREF="#v%3AIntConstr" >IntConstr</A > <A HREF="../integer/GHC-Integer.html#t%3AInteger" >Integer</A ></TD ></TR ><TR ><TD CLASS="decl" >| <A HREF="#v%3AFloatConstr" >FloatConstr</A > <A HREF="../ghc-prim/GHC-Types.html#t%3ADouble" >Double</A ></TD ></TR ><TR ><TD CLASS="decl" >| <A HREF="#v%3AStringConstr" >StringConstr</A > <A HREF="Data-Char.html#t%3AString" >String</A ></TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AconstrRep" >constrRep</A > :: <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> <A HREF="Data-Data.html#t%3AConstrRep" >ConstrRep</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AconstrFields" >constrFields</A > :: <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> [<A HREF="Data-Char.html#t%3AString" >String</A >]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AconstrFixity" >constrFixity</A > :: <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> <A HREF="Data-Data.html#t%3AFixity" >Fixity</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AconstrIndex" >constrIndex</A > :: <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> <A HREF="Data-Data.html#t%3AConIndex" >ConIndex</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AshowConstr" >showConstr</A > :: <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> <A HREF="Data-Char.html#t%3AString" >String</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AreadConstr" >readConstr</A > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Maybe.html#t%3AMaybe" >Maybe</A > <A HREF="Data-Data.html#t%3AConstr" >Constr</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AtyconUQname" >tyconUQname</A > :: <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Char.html#t%3AString" >String</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AtyconModule" >tyconModule</A > :: <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Char.html#t%3AString" >String</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AfromConstr" >fromConstr</A > :: <A HREF="Data-Data.html#t%3AData" >Data</A > a => <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> a</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AfromConstrB" >fromConstrB</A > :: <A HREF="Data-Data.html#t%3AData" >Data</A > a => (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => d) -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> a</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AfromConstrM" >fromConstrM</A > :: (<A HREF="Control-Monad.html#t%3AMonad" >Monad</A > m, <A HREF="Data-Data.html#t%3AData" >Data</A > a) => (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => m d) -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> m a</TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="1" ><A NAME="1" >Module Data.Typeable re-exported for convenience </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" >module <A HREF="Data-Typeable.html" >Data.Typeable</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="2" ><A NAME="2" >The Data class for processing constructor applications </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >class</SPAN > <A HREF="Data-Typeable.html#t%3ATypeable" >Typeable</A > a => <A NAME="t:Data" ><A NAME="t%3AData" ></A ></A ><B >Data</B > a <SPAN CLASS="keyword" >where</SPAN ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" ><P >The <TT ><A HREF="Data-Data.html#t%3AData" >Data</A ></TT > class comprehends a fundamental primitive <TT ><A HREF="Data-Data.html#v%3Agfoldl" >gfoldl</A ></TT > 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 <TT >gmap</TT > combinators later in this class. Indeed, a generic programmer does not necessarily need to use the ingenious gfoldl primitive but rather the intuitive <TT >gmap</TT > combinators. The <TT ><A HREF="Data-Data.html#v%3Agfoldl" >gfoldl</A ></TT > 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 <TT ><A HREF="Data-Data.html#v%3AgmapT" >gmapT</A ></TT >, <TT ><A HREF="Data-Data.html#v%3AgmapQ" >gmapQ</A ></TT >, <TT ><A HREF="Data-Data.html#v%3AgmapM" >gmapM</A ></TT >, etc are all provided with default definitions in terms of <TT ><A HREF="Data-Data.html#v%3Agfoldl" >gfoldl</A ></TT >, leaving open the opportunity to provide datatype-specific definitions. (The inclusion of the <TT >gmap</TT > combinators as members of class <TT ><A HREF="Data-Data.html#t%3AData" >Data</A ></TT > allows the programmer or the compiler to derive specialised, and maybe more efficient code per datatype. <EM >Note</EM >: <TT ><A HREF="Data-Data.html#v%3Agfoldl" >gfoldl</A ></TT > is more higher-order than the <TT >gmap</TT > combinators. This is subject to ongoing benchmarking experiments. It might turn out that the <TT >gmap</TT > combinators will be moved out of the class <TT ><A HREF="Data-Data.html#t%3AData" >Data</A ></TT >.) </P ><P >Conceptually, the definition of the <TT >gmap</TT > combinators in terms of the primitive <TT ><A HREF="Data-Data.html#v%3Agfoldl" >gfoldl</A ></TT > requires the identification of the <TT ><A HREF="Data-Data.html#v%3Agfoldl" >gfoldl</A ></TT > function arguments. Technically, we also need to identify the type constructor <TT >c</TT > for the construction of the result type from the folded term type. </P ><P >In the definition of <TT >gmapQ</TT ><EM >x</EM > combinators, we use phantom type constructors for the <TT >c</TT > in the type of <TT ><A HREF="Data-Data.html#v%3Agfoldl" >gfoldl</A ></TT > because the result type of a query does not involve the (polymorphic) type of the term argument. In the definition of <TT ><A HREF="Data-Data.html#v%3AgmapQl" >gmapQl</A ></TT > we simply use the plain constant type constructor because <TT ><A HREF="Data-Data.html#v%3Agfoldl" >gfoldl</A ></TT > 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., <TT >(:)</TT >). When the query is meant to compute a value of type <TT >r</TT >, then the result type withing generic folding is <TT >r -> r</TT >. So the result of folding is a function to which we finally pass the right unit. </P ><P >With the <TT >-XDeriveDataTypeable</TT > option, GHC can generate instances of the <TT ><A HREF="Data-Data.html#t%3AData" >Data</A ></TT > 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) => 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 -> k (k (z C1)) 2 -> z C2 toConstr (C1 _ _) = con_C1 toConstr C2 = con_C2 dataTypeOf _ = ty_T con_C1 = mkConstr ty_T "C1" [] Prefix con_C2 = mkConstr ty_T "C2" [] Prefix ty_T = mkDataType "Module.T" [con_C1, con_C2] </PRE ><P >This is suitable for datatypes that are exported transparently. </P ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="section4" >Methods</TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A NAME="v:gfoldl" ><A NAME="v%3Agfoldl" ></A ></A ><B >gfoldl</B ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="arg" >:: </TD ><TD CLASS="rdoc" ></TD ></TR ><TR ><TD CLASS="arg" >=> <SPAN CLASS="keyword" >forall</SPAN > d b. <A HREF="Data-Data.html#t%3AData" >Data</A > d => c (d -> b) -> d -> c b</TD ><TD CLASS="rdoc" >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. </TD ></TR ><TR ><TD CLASS="arg" >-> <SPAN CLASS="keyword" >forall</SPAN > g. g -> c g</TD ><TD CLASS="rdoc" >defines how the empty constructor application is folded, like the neutral / start element for list folding. </TD ></TR ><TR ><TD CLASS="arg" >-> a</TD ><TD CLASS="rdoc" >structure to be folded. </TD ></TR ><TR ><TD CLASS="arg" >-> c a</TD ><TD CLASS="rdoc" >result, with a type defined in terms of <TT >a</TT >, but variability is achieved by means of type constructor <TT >c</TT > for the construction of the actual result type. </TD ></TR ><TR ><TD CLASS="ndoc" COLSPAN="2" ><P >Left-associative fold operation for constructor applications. </P ><P >The type of <TT ><A HREF="Data-Data.html#v%3Agfoldl" >gfoldl</A ></TT > is a headache, but operationally it is a simple generalisation of a list fold. </P ><P >The default definition for <TT ><A HREF="Data-Data.html#v%3Agfoldl" >gfoldl</A ></TT > is <TT ><TT ><A HREF="Prelude.html#v%3Aconst" >const</A ></TT > <TT ><A HREF="Prelude.html#v%3Aid" >id</A ></TT ></TT >, which is suitable for abstract datatypes with no substructures. </P ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:gunfold" ><A NAME="v%3Agunfold" ></A ></A ><B >gunfold</B > :: (<SPAN CLASS="keyword" >forall</SPAN > b r. <A HREF="Data-Data.html#t%3AData" >Data</A > b => c (b -> r) -> c r) -> (<SPAN CLASS="keyword" >forall</SPAN > r. r -> c r) -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> c a</TD ></TR ><TR ><TD CLASS="doc" >Unfolding constructor applications </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:toConstr" ><A NAME="v%3AtoConstr" ></A ></A ><B >toConstr</B > :: a -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A ></TD ></TR ><TR ><TD CLASS="doc" >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). </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:dataTypeOf" ><A NAME="v%3AdataTypeOf" ></A ></A ><B >dataTypeOf</B > :: a -> <A HREF="Data-Data.html#t%3ADataType" >DataType</A ></TD ></TR ><TR ><TD CLASS="doc" >The outer type constructor of the type </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:dataCast1" ><A NAME="v%3AdataCast1" ></A ></A ><B >dataCast1</B > :: <A HREF="Data-Typeable.html#t%3ATypeable1" >Typeable1</A > t => (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => c (t d)) -> <A HREF="Data-Maybe.html#t%3AMaybe" >Maybe</A > (c a)</TD ></TR ><TR ><TD CLASS="doc" ><P >Mediate types and unary type constructors. In <TT ><A HREF="Data-Data.html#t%3AData" >Data</A ></TT > instances of the form <TT >T a</TT >, <TT ><A HREF="Data-Data.html#v%3AdataCast1" >dataCast1</A ></TT > should be defined as <TT ><A HREF="Data-Typeable.html#v%3Agcast1" >gcast1</A ></TT >. </P ><P >The default definition is <TT ><TT ><A HREF="Prelude.html#v%3Aconst" >const</A ></TT > <TT ><A HREF="Data-Maybe.html#v%3ANothing" >Nothing</A ></TT ></TT >, which is appropriate for non-unary type constructors. </P ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:dataCast2" ><A NAME="v%3AdataCast2" ></A ></A ><B >dataCast2</B > :: <A HREF="Data-Typeable.html#t%3ATypeable2" >Typeable2</A > t => (<SPAN CLASS="keyword" >forall</SPAN > d e. (<A HREF="Data-Data.html#t%3AData" >Data</A > d, <A HREF="Data-Data.html#t%3AData" >Data</A > e) => c (t d e)) -> <A HREF="Data-Maybe.html#t%3AMaybe" >Maybe</A > (c a)</TD ></TR ><TR ><TD CLASS="doc" ><P >Mediate types and binary type constructors. In <TT ><A HREF="Data-Data.html#t%3AData" >Data</A ></TT > instances of the form <TT >T a b</TT >, <TT ><A HREF="Data-Data.html#v%3AdataCast2" >dataCast2</A ></TT > should be defined as <TT ><A HREF="Data-Typeable.html#v%3Agcast2" >gcast2</A ></TT >. </P ><P >The default definition is <TT ><TT ><A HREF="Prelude.html#v%3Aconst" >const</A ></TT > <TT ><A HREF="Data-Maybe.html#v%3ANothing" >Nothing</A ></TT ></TT >, which is appropriate for non-binary type constructors. </P ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:gmapT" ><A NAME="v%3AgmapT" ></A ></A ><B >gmapT</B > :: (<SPAN CLASS="keyword" >forall</SPAN > b. <A HREF="Data-Data.html#t%3AData" >Data</A > b => b -> b) -> a -> a</TD ></TR ><TR ><TD CLASS="doc" ><P >A generic transformation that maps over the immediate subterms </P ><P >The default definition instantiates the type constructor <TT >c</TT > in the type of <TT ><A HREF="Data-Data.html#v%3Agfoldl" >gfoldl</A ></TT > to an identity datatype constructor, using the isomorphism pair as injection and projection. </P ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:gmapQl" ><A NAME="v%3AgmapQl" ></A ></A ><B >gmapQl</B > :: (r -> r' -> r) -> r -> (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => d -> r') -> a -> r</TD ></TR ><TR ><TD CLASS="doc" >A generic query with a left-associative binary operator </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:gmapQr" ><A NAME="v%3AgmapQr" ></A ></A ><B >gmapQr</B > :: (r' -> r -> r) -> r -> (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => d -> r') -> a -> r</TD ></TR ><TR ><TD CLASS="doc" >A generic query with a right-associative binary operator </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:gmapQ" ><A NAME="v%3AgmapQ" ></A ></A ><B >gmapQ</B > :: (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => d -> u) -> a -> [u]</TD ></TR ><TR ><TD CLASS="doc" >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. </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:gmapQi" ><A NAME="v%3AgmapQi" ></A ></A ><B >gmapQi</B > :: <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => d -> u) -> a -> u</TD ></TR ><TR ><TD CLASS="doc" >A generic query that processes one child by index (zero-based) </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:gmapM" ><A NAME="v%3AgmapM" ></A ></A ><B >gmapM</B > :: <A HREF="Control-Monad.html#t%3AMonad" >Monad</A > m => (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => d -> m d) -> a -> m a</TD ></TR ><TR ><TD CLASS="doc" ><P >A generic monadic transformation that maps over the immediate subterms </P ><P >The default definition instantiates the type constructor <TT >c</TT > in the type of <TT ><A HREF="Data-Data.html#v%3Agfoldl" >gfoldl</A ></TT > to the monad datatype constructor, defining injection and projection using <TT ><A HREF="Control-Monad.html#v%3Areturn" >return</A ></TT > and <TT ><A HREF="Control-Monad.html#v%3A%3E%3E%3D" >>>=</A ></TT >. </P ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:gmapMp" ><A NAME="v%3AgmapMp" ></A ></A ><B >gmapMp</B > :: <A HREF="Control-Monad.html#t%3AMonadPlus" >MonadPlus</A > m => (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => d -> m d) -> a -> m a</TD ></TR ><TR ><TD CLASS="doc" >Transformation of at least one immediate subterm does not fail </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:gmapMo" ><A NAME="v%3AgmapMo" ></A ></A ><B >gmapMo</B > :: <A HREF="Control-Monad.html#t%3AMonadPlus" >MonadPlus</A > m => (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => d -> m d) -> a -> m a</TD ></TR ><TR ><TD CLASS="doc" >Transformation of one immediate subterm with success </TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="section4" ><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Data')" ALT="show/hide" > Instances</TD ></TR ><TR ><TD CLASS="body" ><DIV ID="i:Data" STYLE="display:block;" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="Data-Data.html#t%3AData" >Data</A > <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Data.html#t%3AData" >Data</A > <A HREF="../ghc-prim/GHC-Types.html#t%3AChar" >Char</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Data.html#t%3AData" >Data</A > <A HREF="../ghc-prim/GHC-Types.html#t%3ADouble" >Double</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Data.html#t%3AData" >Data</A > <A HREF="../ghc-prim/GHC-Types.html#t%3AFloat" >Float</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Data.html#t%3AData" >Data</A > <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Data.html#t%3AData" >Data</A > <A HREF="Data-Int.html#t%3AInt8" >Int8</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Data.html#t%3AData" >Data</A > <A HREF="Data-Int.html#t%3AInt16" >Int16</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Data.html#t%3AData" >Data</A > <A HREF="Data-Int.html#t%3AInt32" >Int32</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Data.html#t%3AData" >Data</A > <A HREF="Data-Int.html#t%3AInt64" >Int64</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Data.html#t%3AData" >Data</A > <A HREF="../integer/GHC-Integer.html#t%3AInteger" >Integer</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Data.html#t%3AData" >Data</A > <A HREF="../ghc-prim/GHC-Ordering.html#t%3AOrdering" >Ordering</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Data.html#t%3AData" >Data</A > <A HREF="Data-Word.html#t%3AWord" >Word</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Data.html#t%3AData" >Data</A > <A HREF="Data-Word.html#t%3AWord8" >Word8</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Data.html#t%3AData" >Data</A > <A HREF="Data-Word.html#t%3AWord16" >Word16</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Data.html#t%3AData" >Data</A > <A HREF="Data-Word.html#t%3AWord32" >Word32</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Data.html#t%3AData" >Data</A > <A HREF="Data-Word.html#t%3AWord64" >Word64</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Data.html#t%3AData" >Data</A > <A HREF="../ghc-prim/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Data.html#t%3AData" >Data</A > a => <A HREF="Data-Data.html#t%3AData" >Data</A > ([] a)</TD ></TR ><TR ><TD CLASS="decl" >(<A HREF="Data-Data.html#t%3AData" >Data</A > a, <A HREF="Prelude.html#t%3AIntegral" >Integral</A > a) => <A HREF="Data-Data.html#t%3AData" >Data</A > (<A HREF="Data-Ratio.html#t%3ARatio" >Ratio</A > a)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Typeable.html#t%3ATypeable" >Typeable</A > a => <A HREF="Data-Data.html#t%3AData" >Data</A > (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Data.html#t%3AData" >Data</A > a => <A HREF="Data-Data.html#t%3AData" >Data</A > (<A HREF="Data-Maybe.html#t%3AMaybe" >Maybe</A > a)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Typeable.html#t%3ATypeable" >Typeable</A > a => <A HREF="Data-Data.html#t%3AData" >Data</A > (<A HREF="Foreign-ForeignPtr.html#t%3AForeignPtr" >ForeignPtr</A > a)</TD ></TR ><TR ><TD CLASS="decl" >(<A HREF="Data-Data.html#t%3AData" >Data</A > a, <A HREF="Prelude.html#t%3ARealFloat" >RealFloat</A > a) => <A HREF="Data-Data.html#t%3AData" >Data</A > (<A HREF="Data-Complex.html#t%3AComplex" >Complex</A > a)</TD ></TR ><TR ><TD CLASS="decl" >(<A HREF="Data-Data.html#t%3AData" >Data</A > a, <A HREF="Data-Data.html#t%3AData" >Data</A > b) => <A HREF="Data-Data.html#t%3AData" >Data</A > (<A HREF="Data-Either.html#t%3AEither" >Either</A > a b)</TD ></TR ><TR ><TD CLASS="decl" >(<A HREF="Data-Data.html#t%3AData" >Data</A > a, <A HREF="Data-Data.html#t%3AData" >Data</A > b) => <A HREF="Data-Data.html#t%3AData" >Data</A > (<A HREF="../ghc-prim/GHC-Tuple.html#t%3A%28%2C%29" >(,)</A > a b)</TD ></TR ><TR ><TD CLASS="decl" >(<A HREF="Data-Typeable.html#t%3ATypeable" >Typeable</A > a, <A HREF="Data-Data.html#t%3AData" >Data</A > b, <A HREF="GHC-Arr.html#t%3AIx" >Ix</A > a) => <A HREF="Data-Data.html#t%3AData" >Data</A > (<A HREF="GHC-Arr.html#t%3AArray" >Array</A > a b)</TD ></TR ><TR ><TD CLASS="decl" >(<A HREF="Data-Data.html#t%3AData" >Data</A > a, <A HREF="Data-Data.html#t%3AData" >Data</A > b, <A HREF="Data-Data.html#t%3AData" >Data</A > c) => <A HREF="Data-Data.html#t%3AData" >Data</A > (<A HREF="../ghc-prim/GHC-Tuple.html#t%3A%28%2C%2C%29" >(,,)</A > a b c)</TD ></TR ><TR ><TD CLASS="decl" >(<A HREF="Data-Data.html#t%3AData" >Data</A > a, <A HREF="Data-Data.html#t%3AData" >Data</A > b, <A HREF="Data-Data.html#t%3AData" >Data</A > c, <A HREF="Data-Data.html#t%3AData" >Data</A > d) => <A HREF="Data-Data.html#t%3AData" >Data</A > (<A HREF="../ghc-prim/GHC-Tuple.html#t%3A%28%2C%2C%2C%29" >(,,,)</A > a b c d)</TD ></TR ><TR ><TD CLASS="decl" >(<A HREF="Data-Data.html#t%3AData" >Data</A > a, <A HREF="Data-Data.html#t%3AData" >Data</A > b, <A HREF="Data-Data.html#t%3AData" >Data</A > c, <A HREF="Data-Data.html#t%3AData" >Data</A > d, <A HREF="Data-Data.html#t%3AData" >Data</A > e) => <A HREF="Data-Data.html#t%3AData" >Data</A > (<A HREF="../ghc-prim/GHC-Tuple.html#t%3A%28%2C%2C%2C%2C%29" >(,,,,)</A > a b c d e)</TD ></TR ><TR ><TD CLASS="decl" >(<A HREF="Data-Data.html#t%3AData" >Data</A > a, <A HREF="Data-Data.html#t%3AData" >Data</A > b, <A HREF="Data-Data.html#t%3AData" >Data</A > c, <A HREF="Data-Data.html#t%3AData" >Data</A > d, <A HREF="Data-Data.html#t%3AData" >Data</A > e, <A HREF="Data-Data.html#t%3AData" >Data</A > f) => <A HREF="Data-Data.html#t%3AData" >Data</A > (<A HREF="../ghc-prim/GHC-Tuple.html#t%3A%28%2C%2C%2C%2C%2C%29" >(,,,,,)</A > a b c d e f)</TD ></TR ><TR ><TD CLASS="decl" >(<A HREF="Data-Data.html#t%3AData" >Data</A > a, <A HREF="Data-Data.html#t%3AData" >Data</A > b, <A HREF="Data-Data.html#t%3AData" >Data</A > c, <A HREF="Data-Data.html#t%3AData" >Data</A > d, <A HREF="Data-Data.html#t%3AData" >Data</A > e, <A HREF="Data-Data.html#t%3AData" >Data</A > f, <A HREF="Data-Data.html#t%3AData" >Data</A > g) => <A HREF="Data-Data.html#t%3AData" >Data</A > (<A HREF="../ghc-prim/GHC-Tuple.html#t%3A%28%2C%2C%2C%2C%2C%2C%29" >(,,,,,,)</A > a b c d e f g)</TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="3" ><A NAME="3" >Datatype representations </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A NAME="t:DataType" ><A NAME="t%3ADataType" ></A ></A ><B >DataType</B > </TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" >Representation of datatypes. A package of constructor representations with names of type and module. </TD ></TR ><TR ><TD CLASS="section4" ><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:DataType')" ALT="show/hide" > Instances</TD ></TR ><TR ><TD CLASS="body" ><DIV ID="i:DataType" STYLE="display:block;" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="Text-Show.html#t%3AShow" >Show</A > <A HREF="Data-Data.html#t%3ADataType" >DataType</A ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="4" ><A NAME="4" >Constructors </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkDataType" ><A NAME="v%3AmkDataType" ></A ></A ><B >mkDataType</B > :: <A HREF="Data-Char.html#t%3AString" >String</A > -> [<A HREF="Data-Data.html#t%3AConstr" >Constr</A >] -> <A HREF="Data-Data.html#t%3ADataType" >DataType</A ></TD ></TR ><TR ><TD CLASS="doc" >Constructs an algebraic datatype </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkIntType" ><A NAME="v%3AmkIntType" ></A ></A ><B >mkIntType</B > :: <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Data.html#t%3ADataType" >DataType</A ></TD ></TR ><TR ><TD CLASS="doc" >Constructs the <TT ><A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A ></TT > type </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkFloatType" ><A NAME="v%3AmkFloatType" ></A ></A ><B >mkFloatType</B > :: <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Data.html#t%3ADataType" >DataType</A ></TD ></TR ><TR ><TD CLASS="doc" >Constructs the <TT ><A HREF="../ghc-prim/GHC-Types.html#t%3AFloat" >Float</A ></TT > type </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkStringType" ><A NAME="v%3AmkStringType" ></A ></A ><B >mkStringType</B > :: <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Data.html#t%3ADataType" >DataType</A ></TD ></TR ><TR ><TD CLASS="doc" >Constructs the <TT ><A HREF="Data-Char.html#t%3AString" >String</A ></TT > type </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkNorepType" ><A NAME="v%3AmkNorepType" ></A ></A ><B >mkNorepType</B > :: <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Data.html#t%3ADataType" >DataType</A ></TD ></TR ><TR ><TD CLASS="doc" >Constructs a non-representation for a non-presentable type </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="5" ><A NAME="5" >Observers </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:dataTypeName" ><A NAME="v%3AdataTypeName" ></A ></A ><B >dataTypeName</B > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="Data-Char.html#t%3AString" >String</A ></TD ></TR ><TR ><TD CLASS="doc" >Gets the type constructor including the module </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A NAME="t:DataRep" ><A NAME="t%3ADataRep" ></A ></A ><B >DataRep</B > </TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" >Public representation of datatypes </TD ></TR ><TR ><TD CLASS="section4" >Constructors</TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="arg" ><A NAME="v:AlgRep" ><A NAME="v%3AAlgRep" ></A ></A ><B >AlgRep</B > [<A HREF="Data-Data.html#t%3AConstr" >Constr</A >]</TD ><TD CLASS="rdoc" ></TD ></TR ><TR ><TD CLASS="arg" ><A NAME="v:IntRep" ><A NAME="v%3AIntRep" ></A ></A ><B >IntRep</B ></TD ><TD CLASS="rdoc" ></TD ></TR ><TR ><TD CLASS="arg" ><A NAME="v:FloatRep" ><A NAME="v%3AFloatRep" ></A ></A ><B >FloatRep</B ></TD ><TD CLASS="rdoc" ></TD ></TR ><TR ><TD CLASS="arg" ><A NAME="v:StringRep" ><A NAME="v%3AStringRep" ></A ></A ><B >StringRep</B ></TD ><TD CLASS="rdoc" ></TD ></TR ><TR ><TD CLASS="arg" ><A NAME="v:NoRep" ><A NAME="v%3ANoRep" ></A ></A ><B >NoRep</B ></TD ><TD CLASS="rdoc" ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="section4" ><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:DataRep')" ALT="show/hide" > Instances</TD ></TR ><TR ><TD CLASS="body" ><DIV ID="i:DataRep" STYLE="display:block;" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="Data-Eq.html#t%3AEq" >Eq</A > <A HREF="Data-Data.html#t%3ADataRep" >DataRep</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Text-Show.html#t%3AShow" >Show</A > <A HREF="Data-Data.html#t%3ADataRep" >DataRep</A ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:dataTypeRep" ><A NAME="v%3AdataTypeRep" ></A ></A ><B >dataTypeRep</B > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="Data-Data.html#t%3ADataRep" >DataRep</A ></TD ></TR ><TR ><TD CLASS="doc" >Gets the public presentation of a datatype </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="6" ><A NAME="6" >Convenience functions </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:repConstr" ><A NAME="v%3ArepConstr" ></A ></A ><B >repConstr</B > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="Data-Data.html#t%3AConstrRep" >ConstrRep</A > -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A ></TD ></TR ><TR ><TD CLASS="doc" >Look up a constructor by its representation </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isAlgType" ><A NAME="v%3AisAlgType" ></A ></A ><B >isAlgType</B > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >Test for an algebraic type </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:dataTypeConstrs" ><A NAME="v%3AdataTypeConstrs" ></A ></A ><B >dataTypeConstrs</B > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> [<A HREF="Data-Data.html#t%3AConstr" >Constr</A >]</TD ></TR ><TR ><TD CLASS="doc" >Gets the constructors of an algebraic datatype </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:indexConstr" ><A NAME="v%3AindexConstr" ></A ></A ><B >indexConstr</B > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="Data-Data.html#t%3AConIndex" >ConIndex</A > -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A ></TD ></TR ><TR ><TD CLASS="doc" >Gets the constructor for an index (algebraic datatypes only) </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:maxConstrIndex" ><A NAME="v%3AmaxConstrIndex" ></A ></A ><B >maxConstrIndex</B > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="Data-Data.html#t%3AConIndex" >ConIndex</A ></TD ></TR ><TR ><TD CLASS="doc" >Gets the maximum constructor index of an algebraic datatype </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isNorepType" ><A NAME="v%3AisNorepType" ></A ></A ><B >isNorepType</B > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >Test for a non-representable type </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="7" ><A NAME="7" >Data constructor representations </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A NAME="t:Constr" ><A NAME="t%3AConstr" ></A ></A ><B >Constr</B > </TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" >Representation of constructors </TD ></TR ><TR ><TD CLASS="section4" ><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Constr')" ALT="show/hide" > Instances</TD ></TR ><TR ><TD CLASS="body" ><DIV ID="i:Constr" STYLE="display:block;" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="Data-Eq.html#t%3AEq" >Eq</A > <A HREF="Data-Data.html#t%3AConstr" >Constr</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Text-Show.html#t%3AShow" >Show</A > <A HREF="Data-Data.html#t%3AConstr" >Constr</A ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >type</SPAN > <A NAME="t:ConIndex" ><A NAME="t%3AConIndex" ></A ></A ><B >ConIndex</B > = <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A ></TD ></TR ><TR ><TD CLASS="doc" >Unique index for datatype constructors, counting from 1 in the order they are given in the program text. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A NAME="t:Fixity" ><A NAME="t%3AFixity" ></A ></A ><B >Fixity</B > </TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" >Fixity of constructors </TD ></TR ><TR ><TD CLASS="section4" >Constructors</TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="arg" ><A NAME="v:Prefix" ><A NAME="v%3APrefix" ></A ></A ><B >Prefix</B ></TD ><TD CLASS="rdoc" ></TD ></TR ><TR ><TD CLASS="arg" ><A NAME="v:Infix" ><A NAME="v%3AInfix" ></A ></A ><B >Infix</B ></TD ><TD CLASS="rdoc" ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="section4" ><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Fixity')" ALT="show/hide" > Instances</TD ></TR ><TR ><TD CLASS="body" ><DIV ID="i:Fixity" STYLE="display:block;" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="Data-Eq.html#t%3AEq" >Eq</A > <A HREF="Data-Data.html#t%3AFixity" >Fixity</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Text-Show.html#t%3AShow" >Show</A > <A HREF="Data-Data.html#t%3AFixity" >Fixity</A ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="8" ><A NAME="8" >Constructors </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkConstr" ><A NAME="v%3AmkConstr" ></A ></A ><B >mkConstr</B > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="Data-Char.html#t%3AString" >String</A > -> [<A HREF="Data-Char.html#t%3AString" >String</A >] -> <A HREF="Data-Data.html#t%3AFixity" >Fixity</A > -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A ></TD ></TR ><TR ><TD CLASS="doc" >Constructs a constructor </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkIntConstr" ><A NAME="v%3AmkIntConstr" ></A ></A ><B >mkIntConstr</B > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="../integer/GHC-Integer.html#t%3AInteger" >Integer</A > -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkFloatConstr" ><A NAME="v%3AmkFloatConstr" ></A ></A ><B >mkFloatConstr</B > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="../ghc-prim/GHC-Types.html#t%3ADouble" >Double</A > -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkStringConstr" ><A NAME="v%3AmkStringConstr" ></A ></A ><B >mkStringConstr</B > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="9" ><A NAME="9" >Observers </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:constrType" ><A NAME="v%3AconstrType" ></A ></A ><B >constrType</B > :: <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> <A HREF="Data-Data.html#t%3ADataType" >DataType</A ></TD ></TR ><TR ><TD CLASS="doc" >Gets the datatype of a constructor </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A NAME="t:ConstrRep" ><A NAME="t%3AConstrRep" ></A ></A ><B >ConstrRep</B > </TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" >Public representation of constructors </TD ></TR ><TR ><TD CLASS="section4" >Constructors</TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="arg" ><A NAME="v:AlgConstr" ><A NAME="v%3AAlgConstr" ></A ></A ><B >AlgConstr</B > <A HREF="Data-Data.html#t%3AConIndex" >ConIndex</A ></TD ><TD CLASS="rdoc" ></TD ></TR ><TR ><TD CLASS="arg" ><A NAME="v:IntConstr" ><A NAME="v%3AIntConstr" ></A ></A ><B >IntConstr</B > <A HREF="../integer/GHC-Integer.html#t%3AInteger" >Integer</A ></TD ><TD CLASS="rdoc" ></TD ></TR ><TR ><TD CLASS="arg" ><A NAME="v:FloatConstr" ><A NAME="v%3AFloatConstr" ></A ></A ><B >FloatConstr</B > <A HREF="../ghc-prim/GHC-Types.html#t%3ADouble" >Double</A ></TD ><TD CLASS="rdoc" ></TD ></TR ><TR ><TD CLASS="arg" ><A NAME="v:StringConstr" ><A NAME="v%3AStringConstr" ></A ></A ><B >StringConstr</B > <A HREF="Data-Char.html#t%3AString" >String</A ></TD ><TD CLASS="rdoc" ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="section4" ><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:ConstrRep')" ALT="show/hide" > Instances</TD ></TR ><TR ><TD CLASS="body" ><DIV ID="i:ConstrRep" STYLE="display:block;" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="Data-Eq.html#t%3AEq" >Eq</A > <A HREF="Data-Data.html#t%3AConstrRep" >ConstrRep</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Text-Show.html#t%3AShow" >Show</A > <A HREF="Data-Data.html#t%3AConstrRep" >ConstrRep</A ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:constrRep" ><A NAME="v%3AconstrRep" ></A ></A ><B >constrRep</B > :: <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> <A HREF="Data-Data.html#t%3AConstrRep" >ConstrRep</A ></TD ></TR ><TR ><TD CLASS="doc" >Gets the public presentation of constructors </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:constrFields" ><A NAME="v%3AconstrFields" ></A ></A ><B >constrFields</B > :: <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> [<A HREF="Data-Char.html#t%3AString" >String</A >]</TD ></TR ><TR ><TD CLASS="doc" >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. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:constrFixity" ><A NAME="v%3AconstrFixity" ></A ></A ><B >constrFixity</B > :: <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> <A HREF="Data-Data.html#t%3AFixity" >Fixity</A ></TD ></TR ><TR ><TD CLASS="doc" >Gets the fixity of a constructor </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="10" ><A NAME="10" >Convenience function: algebraic data types </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:constrIndex" ><A NAME="v%3AconstrIndex" ></A ></A ><B >constrIndex</B > :: <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> <A HREF="Data-Data.html#t%3AConIndex" >ConIndex</A ></TD ></TR ><TR ><TD CLASS="doc" >Gets the index of a constructor (algebraic datatypes only) </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="11" ><A NAME="11" >From strings to constructors and vice versa: all data types </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:showConstr" ><A NAME="v%3AshowConstr" ></A ></A ><B >showConstr</B > :: <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> <A HREF="Data-Char.html#t%3AString" >String</A ></TD ></TR ><TR ><TD CLASS="doc" >Gets the string for a constructor </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:readConstr" ><A NAME="v%3AreadConstr" ></A ></A ><B >readConstr</B > :: <A HREF="Data-Data.html#t%3ADataType" >DataType</A > -> <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Maybe.html#t%3AMaybe" >Maybe</A > <A HREF="Data-Data.html#t%3AConstr" >Constr</A ></TD ></TR ><TR ><TD CLASS="doc" >Lookup a constructor via a string </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="12" ><A NAME="12" >Convenience functions: take type constructors apart </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:tyconUQname" ><A NAME="v%3AtyconUQname" ></A ></A ><B >tyconUQname</B > :: <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Char.html#t%3AString" >String</A ></TD ></TR ><TR ><TD CLASS="doc" >Gets the unqualified type constructor: drop *.*.*... before name </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:tyconModule" ><A NAME="v%3AtyconModule" ></A ></A ><B >tyconModule</B > :: <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Char.html#t%3AString" >String</A ></TD ></TR ><TR ><TD CLASS="doc" >Gets the module of a type constructor: take *.*.*... before name </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="13" ><A NAME="13" >Generic operations defined in terms of <TT ><A HREF="Data-Data.html#v%3Agunfold" >gunfold</A ></TT > </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:fromConstr" ><A NAME="v%3AfromConstr" ></A ></A ><B >fromConstr</B > :: <A HREF="Data-Data.html#t%3AData" >Data</A > a => <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> a</TD ></TR ><TR ><TD CLASS="doc" >Build a term skeleton </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:fromConstrB" ><A NAME="v%3AfromConstrB" ></A ></A ><B >fromConstrB</B > :: <A HREF="Data-Data.html#t%3AData" >Data</A > a => (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => d) -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> a</TD ></TR ><TR ><TD CLASS="doc" >Build a term and use a generic function for subterms </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:fromConstrM" ><A NAME="v%3AfromConstrM" ></A ></A ><B >fromConstrM</B > :: (<A HREF="Control-Monad.html#t%3AMonad" >Monad</A > m, <A HREF="Data-Data.html#t%3AData" >Data</A > a) => (<SPAN CLASS="keyword" >forall</SPAN > d. <A HREF="Data-Data.html#t%3AData" >Data</A > d => m d) -> <A HREF="Data-Data.html#t%3AConstr" >Constr</A > -> m a</TD ></TR ><TR ><TD CLASS="doc" >Monadic variation on <TT ><A HREF="Data-Data.html#v%3AfromConstrB" >fromConstrB</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="botbar" >Produced by <A HREF="http://www.haskell.org/haddock/" >Haddock</A > version 2.4.2</TD ></TR ></TABLE ></BODY ></HTML >