ByteString version of Text.Regex?

I want a version of the Text.Regex library where the input is a character-based ByteString instead of a String. I haven't found one on hackage, although I'm not convinced I've looked exhaustively. (Every time I try to explore the regular expression libraries on Hackage, I end up in a maze of documentation, never sure precisely where I am or where I should be going.) It would be really helpful if there were a few English paragraphs somewhere explaining the high-level model provided by the various modules! I ended up taking a version of Text.Regex and making changes to produce a library that works for lazy character ByteStrings. Is that a reasonable thing to do? I'm going to make my software public soon, so I'll either need to release this modified library or swap my version out for a more standard one. Any suggestions on the best way to proceed? Kathleen

The regex-* packages are polymorphic in the string type they accept, so it should be possible to use them with bytestrings. E.g. * http://hackage.haskell.org/package/regex-pcre * http://hackage.haskell.org/package/regex-posix * http://hackage.haskell.org/package/regex-tdfa (you can choose which regex automata you like) kathleen.fisher:
I want a version of the Text.Regex library where the input is a character-based ByteString instead of a String. I haven't found one on hackage, although I'm not convinced I've looked exhaustively. (Every time I try to explore the regular expression libraries on Hackage, I end up in a maze of documentation, never sure precisely where I am or where I should be going.) It would be really helpful if there were a few English paragraphs somewhere explaining the high-level model provided by the various modules!
I ended up taking a version of Text.Regex and making changes to produce a library that works for lazy character ByteStrings. Is that a reasonable thing to do? I'm going to make my software public soon, so I'll either need to release this modified library or swap my version out for a more standard one.
Any suggestions on the best way to proceed?
Kathleen _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

On 4 March 2011 10:43, Don Stewart
The regex-* packages are polymorphic in the string type they accept, so it should be possible to use them with bytestrings.
E.g.
* http://hackage.haskell.org/package/regex-pcre * http://hackage.haskell.org/package/regex-posix * http://hackage.haskell.org/package/regex-tdfa
(you can choose which regex automata you like)
And have a look at the RWH chapter on regexes to get an idea of how to use them: http://book.realworldhaskell.org/read/efficient-file-processing-regular-expr... -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com

Thanks! I got this to work. It would be really helpful if the documentation in Hackage pointed to the examples in RWH (or had similar examples inline). It's not helpful that the documentation on hackage for the context information is out of date (or at least, it says it is out of date). The hapless user (ie, me) is reduced to reading the source code to figure out what different kinds of things the regex matching operators can return. Kathleen On Mar 3, 2011, at 3:52 PM, Ivan Lazar Miljenovic wrote:
On 4 March 2011 10:43, Don Stewart
wrote: The regex-* packages are polymorphic in the string type they accept, so it should be possible to use them with bytestrings.
E.g.
* http://hackage.haskell.org/package/regex-pcre * http://hackage.haskell.org/package/regex-posix * http://hackage.haskell.org/package/regex-tdfa
(you can choose which regex automata you like)
And have a look at the RWH chapter on regexes to get an idea of how to use them: http://book.realworldhaskell.org/read/efficient-file-processing-regular-expr...
-- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com

Also, I think this is a great example of how ratings, comments, and other
metadata (some of which will be present in Hackage 2.0, right?) may help
people navigate the offerings.
I had a similar problem recently with the cryptography packages.
Maybe we should just be writing wiki pages explaining the state of the
packages on Hackage? (Hard to keep up to date.)
As it stands this knowledge seems to mostly reside in mailing list threads
and Reddit/StackOverflow comments.
On Fri, Mar 4, 2011 at 3:03 AM, Kathleen Fisher
Thanks! I got this to work.
It would be really helpful if the documentation in Hackage pointed to the examples in RWH (or had similar examples inline). It's not helpful that the documentation on hackage for the context information is out of date (or at least, it says it is out of date). The hapless user (ie, me) is reduced to reading the source code to figure out what different kinds of things the regex matching operators can return.
Kathleen
On Mar 3, 2011, at 3:52 PM, Ivan Lazar Miljenovic wrote:
On 4 March 2011 10:43, Don Stewart
wrote: The regex-* packages are polymorphic in the string type they accept, so it should be possible to use them with bytestrings.
E.g.
* http://hackage.haskell.org/package/regex-pcre * http://hackage.haskell.org/package/regex-posix * http://hackage.haskell.org/package/regex-tdfa
(you can choose which regex automata you like)
And have a look at the RWH chapter on regexes to get an idea of how to use them: http://book.realworldhaskell.org/read/efficient-file-processing-regular-expr...
-- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
participants (4)
-
Don Stewart
-
Ivan Lazar Miljenovic
-
Kathleen Fisher
-
Ryan Newton