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

Chris Kuklewicz haskell at list.mightyreason.com
Wed Mar 7 04:53:30 EST 2007


Ross Paterson wrote:
> On Mon, Mar 05, 2007 at 03:51:47PM +0000, Chris Kuklewicz wrote:
>> I would like to announce new versions of the regex-* packages.
>> [...]
>> Porting the backends to other Haskell compilers should
>> be possible, though they may not support the polymorphic type class
>> API that regex-base provides.
> 
> Some of the instances in regex-base rely on late overlapping resolution,
> which is a GHC-only feature.  That is, instances overlap, with neither
> subsuming the other, but they're only used outside of the overlap.

I think I will update the "unstable" regex-base with newtypes to separate the
instance.

> 
> The overlap occurs in the following groups of instances:
> 
These problems exists because 'b' in (RegexLike a b) is always an Extract
instance and I cannot simply specify that the third parameter to RegexContext is
"Not an Extract instance" .

For reference:
> type MatchArray = Array Int (MatchOffset, MatchLength)

hmmm....  Imaginary new syntax:
notInstance Extract (MatchOffset, MatchLength)
would fix MatchArray from overlapping with (Extract b => Array Int b)

I will cook up some newtype's and update regex-base.

I only get one "list of _" instance.  Since MatchArray is part of the underlying
machinery, I think I will choose [MatchArray].

Overlap where b == (MatchOffset, MatchLength)
newtype/update:
> 	instance (RegexLike a b) => RegexContext a b (Array Int b)
keep:
> 	instance (RegexLike a b) => RegexContext a b MatchArray

Overlap where b == (MatchOffset, MatchLength)
newtype/update:
> 	instance (RegexLike a b) => RegexContext a b [Array Int b]
keep:
> 	instance (RegexLike a b) => RegexContext a b [MatchArray]

Overlap where b == (MatchOffset, MatchLength)
newtype/update:
> 	instance (RegexLike a b) => RegexContext a b [b]
keep:
> 	instance (RegexLike a b) => RegexContext a b [(MatchOffset,MatchLength)]

Overlap where b == (MatchArray)
newtype/update:
> 	instance (RegexLike a b) => RegexContext a b [b]
keep:
> 	instance (RegexLike a b) => RegexContext a b [MatchArray]
> 
> (MatchArray is a synonym for Array Int (MatchOffset, MatchLength))
> 
> Apart from that, this package (and thus the others, with a few #ifdef's)
> would work with Hugs.  How about eliminating the above overlaps?
> 


More information about the Libraries mailing list