
23 Dec
2007
23 Dec
'07
7:52 a.m.
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