packages feed

regexqq-0.1: docs/Text-Regex-PCRE-QQ.html

<!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.PCRE.QQ</TITLE
><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"
><SCRIPT SRC="haddock-util.js" TYPE="text/javascript"
></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"
>regexqq-0.1: A quasiquoter for Text.Regex.PCRE regexes.</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.PCRE.QQ</FONT
></TD
><TD ALIGN="right"
><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="infohead"
>Portability</TD
><TD CLASS="infoval"
>non-portable (GHC QuasiQuotes)</TD
></TR
><TR
><TD CLASS="infohead"
>Stability</TD
><TD CLASS="infoval"
>unstable</TD
></TR
><TR
><TD CLASS="infohead"
>Maintainer</TD
><TD CLASS="infoval"
>mjm2002@gmail.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
>A quasiquoter for Text.Regex.PCRE regexes.
  This makes use of a new GHC extension known as QuasiQuotes.
  See the README for the temporary location of the docs for
  Language.Haskell.TH.Quote. See the EXAMPLES file for examples.
</P
><PRE
> ghci&gt; [$rx|([aeiou]).*(er|ing|tion)([\.,\?]*)$|] &quot;helloing.!?!?!&quot;
 Just [&quot;elloing.!?!?!&quot;,&quot;e&quot;,&quot;ing&quot;,&quot;.!?!?!&quot;]
</PRE
></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"
><A HREF="#v%3Arx"
>rx</A
> :: QuasiQuoter</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AregexToExpQ"
>regexToExpQ</A
> :: String -&gt; ExpQ</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AregexToPatQ"
>regexToPatQ</A
> :: String -&gt; PatQ</TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Documentation</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3Arx"
></A
><B
>rx</B
> :: QuasiQuoter</TD
></TR
><TR
><TD CLASS="doc"
><PRE
> ghci&gt; maybe [] tail $ [$rx|^([+-])?([0-9]+)\.([0-9]+)|] (show $ negate pi)
 [&quot;-&quot;,&quot;3&quot;,&quot;141592653589793&quot;]
</PRE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AregexToExpQ"
></A
><B
>regexToExpQ</B
> :: String -&gt; ExpQ</TD
></TR
><TR
><TD CLASS="doc"
>Transform a string rep
 of a regex to an ExpQ. The
 resulting ExpQ, when spliced,
 results in a function of type
 <TT
>String -&gt; Maybe [String]</TT
>,
 where the input is the String
 to match on. The result is
 Nothing on error, and Just
 a list of results on success.
 Note: I'm packing/unpacking/...
 the ByteString unnecessarily
 for convenience in testing
 out the first go at this.
 This will be dealt with in
 the future.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AregexToPatQ"
></A
><B
>regexToPatQ</B
> :: String -&gt; PatQ</TD
></TR
><TR
><TD CLASS="doc"
>Transform a string (presumably)
  containing a regex to a PatQ.
 NOTE: Given a regex, a pattern
    is constructed which matches
    a literal string containing
    the verbatim regex. It does
    this because I couldn't think
    of anything better for it to
    do off the cuff. This needs
    thought.
</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.1.0</TD
></TR
></TABLE
></BODY
></HTML
>