mrkkrp / mrkkrp/parser-combinators
[proposal] sepByN
Open
Nobody has claimed this yet.
feature-request
- Dominant language
- Haskell
- Stars
- 55
- Forks
- 17
- PR merge metrics
- No merged PRs in 30d
Description
Thanks for the library!
I was looking for something like sepBy but requiring an exact number of separated elements.
If it's not here yet, maybe it could be added:
sepByN :: Alternative m => m a -> m sep -> Int -> m [a]
sepByN x sep n = (:) <$> x <*> count (n-1) (sep *> x)
It can be used in this "semantic" way:
n & x `sepByN` sep
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
No file or test is named in the proposal. Start by locating the existing sepBy and count combinators, then compare their surrounding API and exports with the proposed sepByN signature. Done means the library exposes an exact-count separated-element combinator matching the stated behavior and semantic usage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100