Hi

> > parseHeader $ BS.pack "hello 252 359"
> (252,359)

If this were strings, I'd start with:

map read . words

If you want to have error correction, I'd move to:

mapM readMay . words

(readMay comes from the safe package, http://www-users.cs.york.ac.uk/~ndm/safe/)

I don't know about the bytestring bit, but I guess the functions all map over.

> I have a bytestring containing two naturals. I was to get them as
> efficiently as possible. Here's my code:

Have you profiled your code and found that the parsing of two Int's
from a bytestring is the performance critial bit? If not, I'd just
keep it simple, and then optimise once you know where you should be
optimising.

Thanks

Neil
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to