I have updated my code as well as made a simple template haskell version. A Wikified homepage can be found at http://haskell.org/hawiki/RegexSyntax
I have found that the syntax combines really really really well with pattern guards. f s | Just 3 <- s =~~ "i/john" = print "exactly 3 johns found." | False <- s =~ "ba*r" = print "no baaaaaaars found" | Just a <- s =~~ "([a-z]*)/(.*)/([a-z]*)" = print $ concat [a!1 ++ a!3, " are the flags. ", a!2, " is the expression"] f _ = print "nothing found!" I am still tweaking the code so expect it to change without notice over the next few days. the template haskell version can be used by importing RegexTH then doing s =~ $(mkRE "i/john") right now, all it does is check syntax and give an error if the regular expression is invalid at compile time, but in the future, it will probably build optimized matchers at compile time. A problem is still that lots of type annotations are needed to resolve the overloading, but it is still okay to use, if anyone has any suggestions on mitigating this, then that would be good. something i have found to be useful, is to use the minimal return type necessary for the task at hand, since any unmatched values will probably need type annotations. John -- --------------------------------------------------------------------------- John Meacham - California Institute of Technology, Alum. - [EMAIL PROTECTED] --------------------------------------------------------------------------- _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell