[Haskell-cafe] Hugs dropped Text.Regex?!

Chris Kuklewicz haskell at list.mightyreason.com
Fri May 4 11:07:05 EDT 2007


John Goerzen wrote:
> I learned today, as I tried to run my ftphs unit tests under Hugs, that
> Hugs dropped Text.Regex between 200503.08 and 200609.21.
> 
> The Hugs download page claims that they did this because the new GHC
> implementation of Text.Regex is not compatible with Hugs.
> 
> But why can't Hugs keep the old implementation?
> 
> This is going to render Hugs just about useless for me.  I like regexps.
> 
> -- John

I will explain how to setup Text.Regex.* for Hugs (I hope)...

I have not been using Hugs, but I have created the current Text.Regex code in
use by GHC.

The stable regex-base package that comes with GHC 6.6 and 6.6.1 has instances
(of RegexContext) that depend on GHC's late resolution of overlapping instances.
 Hugs can only use that with some instanes removed (via the preprocessor).

The unstable regex-base package you can get with darcs is version 0.91 from
http://darcs.haskell.org/packages/regex-unstable/regex-base/ has been modified
to use a few newtypes to allow both GHC and Huge to use all the instances.

>From there you want a backend.  The old backend use the local regex.h api from
the c library and is in the regex-posix version 0.92 package at
http://darcs.haskell.org/packages/regex-unstable/regex-posix/

To get the old haskell API to this backend (Text.Regex itself) you need
regex-compat version 0.90 at
http://darcs.haskell.org/packages/regex-unstable/regex-compat/

To get the new pure haskell backend (works better in almost all cases) you need
regex-tda at
http://darcs.haskell.org/packages/regex-unstable/regex-tdfa/

Note that this regex-tdfa is the latest version, 0.93, which now has the patch
that Ross Paterson sent to me and makes it Hugs compatible.

So it is broken up into several smaller packages.  I think all but
regex-tdfa-0.93 are also available from
http://hackage.haskell.org/packages/archive/pkg-list.html#cat:Text

Cheers,
  Chris


More information about the Haskell-Cafe mailing list