@@ -186,11 +186,12 @@ string_ suspended f s0 = T.Parser $ \t pos more lose succ ->
186186 let n = B.length s
187187 s = f s0
188188 in if lengthAtLeast pos n t
189− then if s == substring pos (Pos n) t
190− then succ t (pos + Pos n) more s
191− else lose t pos more [] "string"
189+ then let t' = substring pos (Pos n) t
190+ in if s == f t'
191+ then succ t (pos + Pos n) more t'
192+ else lose t pos more [] "string"
192193 else let t' = Buf.unsafeDrop (fromPos pos) t
193− in if t' `B.isPrefixOf` s
194+ in if f t' `B.isPrefixOf` s
194195 then suspended s (B.drop (B.length t') s) t pos more lose succ
195196 else lose t pos more [] "string"
196197{-# INLINE string_ #-}