Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 1f2b142b9d2ef4849a6f5316fa1c5b12 > files > 2801

ghc-6.10.4-1mdv2010.0.i586.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
>Text.Regex.Base.Context</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_Text-Regex-Base-Context.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"
>regex-base-0.72.0.2: Replaces/Enhances Text.Regex</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"
>Text.Regex.Base.Context</FONT
></TD
><TD ALIGN="right"
><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="infohead"
>Portability</TD
><TD CLASS="infoval"
>non-portable (MPTC+FD)</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, textregexlazy@personal.mightyreason.com</TD
></TR
></TABLE
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Description</TD
></TR
><TR
><TD CLASS="doc"
><P
>This is a module of instances of <TT
><A HREF="Text-Regex-Base-RegexLike.html#t%3ARegexContext"
>RegexContext</A
></TT
>.  Nothing else is
exported.   These work for all the front ends and backends
interchangably.  These instances are important because they provide
the different results that can be gotten from a match or matchM
operation (often via the <TT
>=~</TT
> and <TT
>=~~</TT
> operators).  The name is Context
because they are context dependent: use them in a context that expects
an Int and you get a count of matches, use them in a Bool context and
get True if there is a match, etc.
</P
><PRE
> 
type MatchArray = Array Int (MatchOffset, MatchLength)
type MatchText source = Array Int (source, (MatchOffset, MatchLength))
</PRE
><P
>These are for the first match:
</P
><P
>(<TT
> RegexLike a b =&gt; RegexContext a b Bool </TT
>) :
  Whether there is any match or not
</P
><P
>(<TT
> RegexLike a b =&gt; RegexContext a b () </TT
>) :
  Useful using <TT
>=~~</TT
> in a monad, since failure to match is via <TT
><A HREF="../base/Control-Monad.html#v%3Afail"
>fail</A
></TT
>
</P
><P
>(<TT
> RegexLike a b =&gt; RegexContext a b (MatchOffset,MatchLength) </TT
>) :
  This returns the initial index and length of the whole match.
  Starting at (-1) indicates failure to match.
</P
><P
>(<TT
> RegexLike a b =&gt; RegexContext a b b </TT
>) :
  This returns the text of the whole match.
  It will return <TT
><A HREF="Text-Regex-Base-RegexLike.html#v%3Aempty"
>empty</A
></TT
> from <TT
><A HREF="Text-Regex-Base-RegexLike.html#t%3AExtract"
>Extract</A
></TT
> if there is no match.
  These are defined in other modules, but documented here for convenience.
</P
><P
>(<TT
> RegexLike a b =&gt; RegexContext a b MatchArray </TT
>) :
  Where each sub-part the match starts and its length.
  Starting at (-1) indicates unused.
</P
><P
>(<TT
> RegexLike a b =&gt; RegexContext a b (Array Int b) </TT
>) :
  The text of each sub-part of the match.
  Unused matches are <TT
><A HREF="Text-Regex-Base-RegexLike.html#v%3Aempty"
>empty</A
></TT
> (defined via <TT
><A HREF="Text-Regex-Base-RegexLike.html#t%3AExtract"
>Extract</A
></TT
>)
</P
><P
>(<TT
> RegexLike a b =&gt; RegexContext a b (b, MatchText b, b) </TT
>) :
  The text before the match, the details of the match, and the text after the match
</P
><P
>(<TT
> RegexLike a b =&gt; RegexContext a b (b, b, b) </TT
>) :
  The text before the match, the text of the match, the text after the match
</P
><P
>(<TT
> RegexLike a b =&gt; RegexContext a b (b, b, b, [b]) </TT
>) :
  The text before the match, the text of the match, the text after the match, and the text of the 1st and higher sub-parts of the match.  This is the same return value as used in Text.Regex.
</P
><P
>(<TT
> RegexLike a b =&gt; RegexContext a b (MatchResult b) </TT
>) :
  The <TT
><A HREF="Text-Regex-Base-RegexLike.html#t%3AMatchResult"
>MatchResult</A
></TT
> structure for the match.
</P
><P
>These instances are for all the matches (non-overlapping):
</P
><P
>(<TT
> RegexLike a b =&gt; RegexContext a b Int </TT
>) :
  The number of matches
</P
><P
>These instances similar to the single match ones above, but in a List:
</P
><P
>(<TT
> RegexLike a b =&gt; RegexContext a b [(MatchOffset, MatchLength)] </TT
>) :
</P
><P
>(<TT
> RegexLike a b =&gt; RegexContext a b [b] </TT
>) :
  As a policy, I chose [b] to be the list of whole text of each match.
</P
><P
>(<TT
> RegexLike a b =&gt; RegexContext a b [MatchArray] </TT
>) :
</P
><P
>(<TT
> RegexLike a b =&gt; RegexContext a b [Array Int b] </TT
>) :
</P
><P
>(<TT
> RegexLike a b =&gt; RegexContext a b [MatchText b] </TT
>) :
</P
><P
>(<TT
> RegexLike a b =&gt; RegexContext a b [[b]] </TT
>) :
  This is the list of the list of the text of the sub-part of each match.
  Unused matches are <TT
><A HREF="Text-Regex-Base-RegexLike.html#v%3Aempty"
>empty</A
></TT
> (defined via <TT
><A HREF="Text-Regex-Base-RegexLike.html#t%3AExtract"
>Extract</A
></TT
>)
</P
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="s15"
></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
>