How do I convert a ByteString representation of an Integer to … well Integer?
Is there a special read function for ByteStrings or do I have to unpack first than use normal read?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use
readIntorreadIntegerfromData.ByteString.Char8. If you want to read some other type of data, you’ll need to write your own parser; the best choice is probably attoparsec, which is a library for writing fastByteStringandTextparsers, similar to Parsec.