[Haskell-cafe] Re: Compiling regex-posix-0.93.2 on windows

ChrisK haskell at list.mightyreason.com
Thu Jan 15 17:00:50 EST 2009


Paulo: I suggest doing this more carefully.

Get the source from hackage.

Edit the regex-posix.cabal file to add the include and lib directories you need 
on Cygwin.

cabal "configure" it.

cabal "build" it.

cabal "install" it.

Then in an unrelated directory try and run "ghci -package regex-posix".  This 
should load regex-posix-VERSION.  If this fails then I think that the cabal file 
needs fixing.

If that works then please test it with these commands:
> Prelude> :m + Text.Regex.Posix
> Prelude Text.Regex.Posix> (Text.Regex.Posix.=~) "ab" "(()|[ab])(b)" :: (String,String,String,[String])

The right answer by the way is:
 > ("","ab","",["a","","b"])

But on FreeBSD/NetBSD/OS X there is a bug that I have found and it prints:
 > ("a","b","",["","","b"])

Which just goes to show that a mountain of QuickCheck is what is sometimes 
needed to catch really hard to trigger bugs.

This is the other bug I reported:
> Prelude Text.Regex.Posix> (Text.Regex.Posix.=~) "XababaY" "(X)(aba|ab|b)*(Y)" :: (String,String,String,[String])
> ("","XababaY","",["X","b","Y"])

The above answer is impossible (what matched "a" next to "b"?), but I now think 
I know WTF the library code is doing wrong (I think it is matching "ababa" in 
two passes and the second pass is greedy which is a broken strategy).  The right 
answer is:

 > ("","XababaY","",["X","aba","Y"])

Cheers,
   Chris

PS: Yes, I have reported these bug to Apple, FreeBSD, and NetBSD this month.



More information about the Haskell-Cafe mailing list