[Haskell-cafe] ANN: New release of regex packages

Chris Kuklewicz haskell at list.mightyreason.com
Wed Mar 7 06:28:06 EST 2007


Ross Paterson wrote:

> Apart from that, this package (and thus the others, with a few #ifdef's)
> would work with Hugs.  How about eliminating the above overlaps?
> 

I don't have Hugs installed, so could you try porting the regex-base in the HEAD of
http://darcs.haskell.org/packages/regex-unstable/regex-base
that I just updated?

This creates 4 newtypes in the RegexLike module that are used in RegexContext to
disambiguate the semantics and remove the overlap that Hugs complains about:

newtype AllSubmatches f b = AllSubmatches {getAllSubmatches :: (f b)}
newtype AllTextSubmatches f b = AllTextSubmatches (f b)
newtype AllMatches f b = AllMatches (f b)
newtype AllTextMatches f b = AllTextMatches (f b)

This has another benefit, in that I don't have to choose whether the result type
of [b] is the submatches or all the whole matches, since I now use newtypes to
provide both flavors.

And most things are now available as either a list or an (Array Int).  And [[b]]
is now available in all 4 list/array flavors.

-- 
Chris


More information about the Libraries mailing list