 | regexqq-0.1: A quasiquoter for Text.Regex.PCRE regexes. | Contents | Index |
|
| Text.Regex.PCRE.QQ | | Portability | non-portable (GHC QuasiQuotes) | | Stability | unstable | | Maintainer | mjm2002@gmail.com |
|
|
|
| Description |
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.
ghci> [$rx|([aeiou]).*(er|ing|tion)([\.,\?]*)$|] "helloing.!?!?!"
Just ["elloing.!?!?!","e","ing",".!?!?!"]
|
|
| Synopsis |
|
|
|
| Documentation |
|
| rx :: QuasiQuoter |
ghci> maybe [] tail $ [$rx|^([+-])?([0-9]+)\.([0-9]+)|] (show $ negate pi)
["-","3","141592653589793"]
|
|
| regexToExpQ :: String -> ExpQ |
| Transform a string rep
of a regex to an ExpQ. The
resulting ExpQ, when spliced,
results in a function of type
String -> Maybe [String],
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.
|
|
| regexToPatQ :: String -> PatQ |
| 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.
|
|
| Produced by Haddock version 2.1.0 |