
On 10.02.2013 02:30, Nicolas Bock wrote:
Hi Aleksey,
could you show me how I would use ByteString? I can't get the script to compile. It's complaining that:
No instance for (RegexContext Regex Data.ByteString.ByteString (AllTextSubmatches [] a0))
which is too cryptic for me. Is it not able to form a regular expression with a ByteString argument? From the documentation of Text.Regex.Posix it seems that it should be. Maybe it's because I am trying to "read (r!!1) :: Double" which I am having issues with also. Is (r!!1) a ByteString? And if so, how would I convert that to a Double?
It's error message from regex library you use. I can't say what exactly it means, I never used it. But most likely it cannot work with bytestrings. Most other languages rely on regexp as go to tool for parsing. In haskell main parsing tools are parser combinators such as parsec[1] or attoparsec[2]. Parsec is more generic and attoparsec is much faster. In attachment program which uses attoparsec for parsing it's about 2times slower than C++ example posted in the thread. [1] http://hackage.haskell.org/package/parsec [2] http://hackage.haskell.org/package/attoparsec