j-mie6 / parsley

A fast and modern parser combinator library for Scala
https://j-mie6.github.io/parsley/
BSD 3-Clause "New" or "Revised" License
173 stars 15 forks source link

Satisfy that maps #186

Closed j-mie6 closed 11 months ago

j-mie6 commented 1 year ago

Instead of satisfy(f).map(g), it might be nice to support a partial function satisfy { case x if f(x) => g(x) } style of combinator, this can be then optimised and replace the SatisfyExchange instruction with a const function or something like that. Worth exploring! It might be possible to do this as an overload, not sure.

j-mie6 commented 1 year ago

Overload isn't possible, one of the following names will work well: satisfyMap, mapSatisfy, satisfyAs.