Open lsmor opened 1 year ago
Hi there!!
Are you accepting PRs? from the conversation in #31 It seems that you prefer to keep the library smaller :).
This case seems to be quite particular. I agree that adding an element to the end of the linked list in inefficient, but then there could be many ways to avoid building a list at all (e.g. by counting the number of symbols matched before eof instead of building a list), or to avoid eof
being represented by an element in the list. All this seems to belong to the area of creativity that concerns the code of a particular parser, not a library of common combinators.
Hi! may you consider adding
manyEndingWith
(name subject to change)? The code would be like:This is particulary usefull when parsing the
eof
. For example inmegaparsec
this code will hang foreverIdeally the last example could return
Right [True, True, False]
, but I think it isn't possible with the current combinators. With the new combinator the above example could be rewritten asI know
manyTill_
exists but, It returnsm ([a], end)
, forcing you to appendend
at the end of the list (ifa ~ end
), which is inefficient for linked lists.