haskell - Implementing skipWhile1 in attoparsec -
attoparsec provides function takewhile1
consumes @ least 1 character.
however, there no analog skipwhile
. how can implement function skipwhile1
?
note: question intentionally shows no research effort answered q&a-style.
another possible implementation:
import control.applicative skipwhile1 p = skip p *> skipwhile p
this might faster @uli's answer because takewhile
builds result string, whereas skipwhile
doesn't. laziness might make them equivalent (ie. maybe takewhile
doesn't build string if don't use it); can't test @ moment verify this.
Comments
Post a Comment