Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 77f0c8b2568c8ba86bf4498d38e7ecdc > files > 774

ghc-base-devel-4.2.0.2-8.6.fc14.x86_64.rpm

<!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.Version</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-Version.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.2.0.2: 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.Version</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 in ReadP)</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"
>The <TT
>Version</TT
> type
</A
></DT
><DT
><A HREF="#2"
>A concrete representation of <TT
>Version</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
>A general library for representation and manipulation of versions.
</P
><P
>Versioning schemes are many and varied, so the version
 representation provided by this library is intended to be a
 compromise between complete generality, where almost no common
 functionality could reasonably be provided, and fixing a particular
 versioning scheme, which would probably be too restrictive.
</P
><P
>So the approach taken here is to provide a representation which
 subsumes many of the versioning schemes commonly in use, and we
 provide implementations of <TT
><A HREF="Data-Eq.html#t%3AEq"
>Eq</A
></TT
>, <TT
><A HREF="Data-Ord.html#t%3AOrd"
>Ord</A
></TT
> and conversion to/from <TT
><A HREF="Data-Char.html#t%3AString"
>String</A
></TT
>
 which will be appropriate for some applications, but not all.
</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"
><SPAN CLASS="keyword"
>data</SPAN
>  <A HREF="#t%3AVersion"
>Version</A
>  = <A HREF="#v%3AVersion"
>Version</A
> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="recfield"
><A HREF="#v%3AversionBranch"
>versionBranch</A
> :: [<A HREF="Data-Int.html#t%3AInt"
>Int</A
>]</TD
></TR
><TR
><TD CLASS="recfield"
><A HREF="#v%3AversionTags"
>versionTags</A
> :: [<A HREF="Data-Char.html#t%3AString"
>String</A
>]</TD
></TR
></TABLE
>}</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AshowVersion"
>showVersion</A
> :: <A HREF="Data-Version.html#t%3AVersion"
>Version</A
> -&gt; <A HREF="Data-Char.html#t%3AString"
>String</A
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AparseVersion"
>parseVersion</A
> :: <A HREF="Text-ParserCombinators-ReadP.html#t%3AReadP"
>ReadP</A
> <A HREF="Data-Version.html#t%3AVersion"
>Version</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"
>The <TT
>Version</TT
> type
</A
></A
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>data</SPAN
>  <A NAME="t:Version"
><A NAME="t%3AVersion"
></A
></A
><B
>Version</B
>  </TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="ndoc"
><P
>A <TT
><A HREF="Data-Version.html#t%3AVersion"
>Version</A
></TT
> represents the version of a software entity.  
</P
><P
>An instance of <TT
><A HREF="Data-Eq.html#t%3AEq"
>Eq</A
></TT
> is provided, which implements exact equality
modulo reordering of the tags in the <TT
><A HREF="Data-Version.html#v%3AversionTags"
>versionTags</A
></TT
> field.
</P
><P
>An instance of <TT
><A HREF="Data-Ord.html#t%3AOrd"
>Ord</A
></TT
> is also provided, which gives lexicographic
ordering on the <TT
><A HREF="Data-Version.html#v%3AversionBranch"
>versionBranch</A
></TT
> fields (i.e. 2.1 &gt; 2.0, 1.2.3 &gt; 1.2.2,
etc.).  This is expected to be sufficient for many uses, but note that
you may need to use a more specific ordering for your versioning
scheme.  For example, some versioning schemes may include pre-releases
which have tags <TT
>&quot;pre1&quot;</TT
>, <TT
>&quot;pre2&quot;</TT
>, and so on, and these would need to
be taken into account when determining ordering.  In some cases, date
ordering may be more appropriate, so the application would have to
look for <TT
>date</TT
> tags in the <TT
><A HREF="Data-Version.html#v%3AversionTags"
>versionTags</A
></TT
> field and compare those.
The bottom line is, don't always assume that <TT
><A HREF="Data-Ord.html#v%3Acompare"
>compare</A
></TT
> and other <TT
><A HREF="Data-Ord.html#t%3AOrd"
>Ord</A
></TT
>
operations are the right thing for every <TT
><A HREF="Data-Version.html#t%3AVersion"
>Version</A
></TT
>.
</P
><P
>Similarly, concrete representations of versions may differ.  One
possible concrete representation is provided (see <TT
><A HREF="Data-Version.html#v%3AshowVersion"
>showVersion</A
></TT
> and
<TT
><A HREF="Data-Version.html#v%3AparseVersion"
>parseVersion</A
></TT
>), but depending on the application a different concrete
representation may be more appropriate.
</P
></TD
></TR
><TR
><TD CLASS="section4"
>Constructors</TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0"
><TR
><TD CLASS="arg"
><A NAME="v:Version"
><A NAME="v%3AVersion"
></A
></A
><B
>Version</B
></TD
><TD CLASS="rdoc"
></TD
></TR
><TR
><TD CLASS="body" COLSPAN="2"
><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"
><TR
><TD CLASS="arg"
><A NAME="v:versionBranch"
><A NAME="v%3AversionBranch"
></A
></A
><B
>versionBranch</B
> :: [<A HREF="Data-Int.html#t%3AInt"
>Int</A
>]</TD
><TD CLASS="rdoc"
><P
>The numeric branch for this version.  This reflects the
 fact that most software versions are tree-structured; there
 is a main trunk which is tagged with versions at various
 points (1,2,3...), and the first branch off the trunk after
 version 3 is 3.1, the second branch off the trunk after
 version 3 is 3.2, and so on.  The tree can be branched
 arbitrarily, just by adding more digits.
</P
><P
>We represent the branch as a list of <TT
><A HREF="Data-Int.html#t%3AInt"
>Int</A
></TT
>, so
 version 3.2.1 becomes [3,2,1].  Lexicographic ordering
 (i.e. the default instance of <TT
><A HREF="Data-Ord.html#t%3AOrd"
>Ord</A
></TT
> for <TT
>[Int]</TT
>) gives
 the natural ordering of branches.
</P
></TD
></TR
><TR
><TD CLASS="arg"
><A NAME="v:versionTags"
><A NAME="v%3AversionTags"
></A
></A
><B
>versionTags</B
> :: [<A HREF="Data-Char.html#t%3AString"
>String</A
>]</TD
><TD CLASS="rdoc"
>A version can be tagged with an arbitrary list of strings.
 The interpretation of the list of tags is entirely dependent
 on the entity that this version applies to.
</TD
></TR
></TABLE
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="section4"
><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Version')" ALT="show/hide"
> Instances</TD
></TR
><TR
><TD CLASS="body"
><DIV ID="i:Version" 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-Version.html#t%3AVersion"
>Version</A
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="Data-Ord.html#t%3AOrd"
>Ord</A
> <A HREF="Data-Version.html#t%3AVersion"
>Version</A
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="Text-Read.html#t%3ARead"
>Read</A
> <A HREF="Data-Version.html#t%3AVersion"
>Version</A
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="Text-Show.html#t%3AShow"
>Show</A
> <A HREF="Data-Version.html#t%3AVersion"
>Version</A
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="Data-Typeable.html#t%3ATypeable"
>Typeable</A
> <A HREF="Data-Version.html#t%3AVersion"
>Version</A
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
><A NAME="2"
><A NAME="2"
>A concrete representation of <TT
>Version</TT
>
</A
></A
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:showVersion"
><A NAME="v%3AshowVersion"
></A
></A
><B
>showVersion</B
> :: <A HREF="Data-Version.html#t%3AVersion"
>Version</A
> -&gt; <A HREF="Data-Char.html#t%3AString"
>String</A
></TD
></TR
><TR
><TD CLASS="doc"
>Provides one possible concrete representation for <TT
><A HREF="Data-Version.html#t%3AVersion"
>Version</A
></TT
>.  For
 a version with <TT
><A HREF="Data-Version.html#v%3AversionBranch"
>versionBranch</A
></TT
> <TT
>= [1,2,3]</TT
> and <TT
><A HREF="Data-Version.html#v%3AversionTags"
>versionTags</A
></TT
> 
 <TT
>= [&quot;tag1&quot;,&quot;tag2&quot;]</TT
>, the output will be <TT
>1.2.3-tag1-tag2</TT
>.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:parseVersion"
><A NAME="v%3AparseVersion"
></A
></A
><B
>parseVersion</B
> :: <A HREF="Text-ParserCombinators-ReadP.html#t%3AReadP"
>ReadP</A
> <A HREF="Data-Version.html#t%3AVersion"
>Version</A
></TD
></TR
><TR
><TD CLASS="doc"
>A parser for versions in the format produced by <TT
><A HREF="Data-Version.html#v%3AshowVersion"
>showVersion</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.6.1</TD
></TR
></TABLE
></BODY
></HTML
>