-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide buffer parser i.e. runParserPtr :: ParserIO e a -> Ptr Word8 -> Int -> _
#57
Comments
Something I note is that since flatparse carries around a |
The problem I've come against here is that On a related note, what is the reason for ferrying a Edit: I see that the I might try writing a buffer parser parallel to flatparse but without carrying around the |
IIRC I added |
As I understand it's convenient because all the It's not a complaint with the library since we advertise it as a |
How can it happen that we have a |
What about parsing from a buffer provided by |
It would work with as much safety guarantee as That said, if we add |
You're right, now I understand that I'm very happy with the internal parser design. Thanks for your patience and explanations :) |
Btw, is there a standard function that turns |
I can't find any |
I guess we can just go with |
Brief preamble. I'm using flatparse for some binary file parsing. I'm parsing a filetable, where I know the precise length. I'm operating on
Ptr
s because I want the core to be source-agnostic (whether working on bytestrings directly, or file handles etc.). I could copy the bytes into a bytestring and parse, but I figure, why don't I parse an address directly? To my (limited) knowledge, it would seem sensible, assuming the lifetime is handled externally (e.g. usingwithForeignPtr
).Assuming good intentions (no lying about pointers or their length), would a
runParserPtr :: ParserIO e a -> Ptr Word8 -> Int -> _
be useful and safe? With lots of warnings on pitfalls of course.I can provide some example code if useful.
The text was updated successfully, but these errors were encountered: