Say I have an attoparsec parser, x
.
I am looking to create a function f :: Int -> Parser a -> Parser a
, such that if y = f n x
, then:
y
fails ifx
failsy
fails ifx
succeeds andx
does not consumen
bytesy
succeeds otherwise
How would I go about doing this?