[Haskell-beginners] Pure Regex.PCRE Possible? (PLEAC, Fix Style)
Chaddaï Fouché
chaddai.fouche at gmail.com
Sun Dec 20 04:16:59 EST 2009
On Sat, Dec 19, 2009 at 2:37 PM, Volkan YAZICI <yazicivo at ttmail.com> wrote:
> However, if I'm not mistaken, above functions _should_ be absolutely
> pure. Is it possible to encapsulate impure PCRE functions into their
> pure equivalents?
>
> BTW, why are PCRE functions impure?
Mainly because they _are_ the core that _is_ encapsulated as you
suggested : regex-pcre as many other regex library, provides the same
basic mostly pure interface which is in regex-base.
That interface comes with many specific pure function (matchText,
matchOnce, matchAll and so on, as well as makeRegex and others) and
some "magic" operators like =~ which decides what kind of matching you
want to do depending on the type of the result.
See this tutorial for some example of usage :
http://www.serpentine.com/blog/2007/02/27/a-haskell-regular-expression-tutorial/
--
Jedaï
More information about the Beginners
mailing list