scanner

Fast non-backtracking incremental combinator parsing for bytestrings

https://github.com/Yuras/scanner

LTS Haskell 22.39:0.3.1
Stackage Nightly 2024-10-31:0.3.1
Latest on Hackage:0.3.1

See all snapshots scanner appears in

BSD-3-Clause licensed by Yuras Shumovich
Maintained by [email protected]
This version can be pinned in stack with:scanner-0.3.1@sha256:6b90f2e4ff01895b69cc53885550b85a0536a702b90947ade4ac34d6435ce5a8,2018

Module documentation for 0.3.1

Depends on 3 packages(full list with versions):
Used by 2 packages in nightly-2022-09-19(full list with versions):

scanner

Fast non-backtracking incremental combinator parsing for bytestrings

Build Status

On hackage: http://hackage.haskell.org/package/scanner

On stackage: https://www.stackage.org/package/scanner

It is often convinient to use backtracking to parse some sophisticated input. Unfortunately it kills performance, so usually you should avoid backtracking.

Often (actually always, but it could be too hard sometimes) you can implement your parser without any backtracking. It that case all the bookkeeping usuall parser combinators do becomes unnecessary. The scanner library is designed for such cases. It is often 2 times faster then attoparsec.

As an example, please checkout redis protocol parser included into the repo, both using attoparsec and scanner libraries: https://github.com/Yuras/scanner/tree/master/examples/Redis

Benchmark results:

Bechmark results

But if you really really really need backtracking, then you can just inject attoparsec parser into a scanner: http://hackage.haskell.org/package/scanner-attoparsec

Changes

0.3.1

  • support ghc-8.8

0.3

  • add foldWhile, foldWhile1, satisfy, satisfyMaybe

0.2

0.1

  • initial release