[Haskell-cafe] regex libraries: matching operators (=~) and (=~~) are not methods

José Romildo Malaquias j.romildo at gmail.com
Tue Nov 30 20:50:02 CET 2010


When learning how to use the many regular expression libraries for
Haskell, I noticed that the interface API from the regex-base package
introduces several high level operations that are abstracted from the
implementations (backends). This is done by means of classes.

For instance, there are methods for compiling an external representation
(like a string or a bytestring) into a regular expression. There are
also methods for matching a regular expression and some text (like a
string, or a bytestring).

But the most high level functions for pattern matching using regular
expressions, (=~) and (=~~), are not defined as methods in a class.
They are independent functions defined for each backend in the
corresponding package.

This prevents one from writing a general function using these operators
without deliberately choosing a regex backend.

Why are those operators not defined as methods, like all other relevant


More information about the Haskell-Cafe mailing list