[Haskell-cafe] Re: regex package for yhc?

ChrisK haskell at list.mightyreason.com
Thu Dec 6 16:41:47 EST 2007

Thomas Hartman wrote:
> Is there some way to use any of the various regex packages on hackage
> via yhc? Has anyone installed one them successfully?
> I'd like regex-tdfa, but would settle for regex-posix, or really,
> anything that brings the convenience of regex to yhc.
> In general, is there a straightforward way to install "extralibs" type
> packages for universal "import" availability in yhc?
> Is there a cabal equivalent for yhc? Documentation pointer would be
> appreciated; I searched but couldn't find anything. Maybe not using the
> right keywords...
> t.

I put the regex-* packages on hackage.  I have had no reports of use with yhc.

Some of the convenience comes from the regex-base font end.

The high level (=~) and 'match' regex API depends on the MPTC's of regex-base,
and these currently use functional dependencies.  This works on GHC and Hugs.

I cannot quickly find on http://www.haskell.org/haskellwiki/Yhc what YHC supports.

The regex-posix package is a backend, the oldest.  It exposes the platform's
POSIX regex.h library through the FFI calls in Text/Regex/Posix/Wrap.hsc.  This
C api is further layered in the data type specific modules:


And all of that is re-exported in


A similar design is followed by the regex-pcre backend (and the deprecated
regex-tre backend).

One _could_ refactor regex-posix into two packages.  One would give standalone
accesses to the backend and simply be Haskell98 + FFI.  The other would declare
the instances to make this available though regex-base.

The regex-tdfa backend is my own creation, and is not a wrapper for another
library.   It uses some non-Haskell98 syntax, such as the "mdo" syntactic sugar
for MonadFix (aka recursive do).


More information about the Haskell-Cafe mailing list