AndrasKovacs / AndrasKovacs/flatparse
Provide buffer parser i.e. `runParserPtr :: ParserIO e a -> Ptr Word8 -> Int -> _`
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 178
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
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 Ptrs 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. using withForeignPtr).
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing ParserIO API and how parser inputs and lifetimes are currently handled. Determine whether a pointer-and-length entry point can be specified with safe lifetime and bounds expectations; done requires a decided API design, documented pitfalls, and corresponding implementation or a clear resolution that it is not safe or useful.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100