[Haskell-cafe] Package for regular expressions

Omari Norman omari at smileystation.com
Sun Feb 9 15:15:07 UTC 2014


On Sun, Feb 9, 2014 at 6:14 AM, Daniil Frumin <difrumin at gmail.com> wrote:
>
> What is up with the regular expression packages? Which one is the go-to package?
> There are really a bunch of them around (regex-compat, regex-tdfa,
> regex-posicx, regex-compat-tdfa,, ..) and it's not obvious at all what
> is the difference between them and which one should I use.

The great bulk of those packages accompany regex-base.  They provide
"backends" which you then use through the pcre-base interface.

pcre-base has a heavily overloaded interface. It's novel, but I think
understanding what it is really doing is not at all straightforward.
This is exemplified by the chapter about regular expressions in Real
World Haskell, which dismisses explaining what one of the functions
does with "As a result, the type signature of the (=~) operator is
difficult to understand, so we will not explain it here."

http://book.realworldhaskell.org/read/efficient-file-processing-regular-expressions-and-file-name-matching.html

For something easier to understand, I recommend pcre-light.  Its types
are straightforward.


More information about the Haskell-Cafe mailing list