attoparsec Documentation
repository·master·Indexed 19 days ago
https://github.com/haskell/attoparsecA high-performance Haskell parser combinator library optimized for parsing network protocols and complex text or binary formats. It utilizes a continuation-based approach for efficient input handling and is designed for high-speed parsing of byte arrays.
What's inside attoparsec
- attoparsec is a high-performance Haskell parser combinator library. It is specifically designed for efficient parsing of network protocols and complex text or binary file formats.
Compare Attoparsec with Parsec for performance and error handling
masterWhen choosing between Attoparsec and Parsec, consider your specific requirements for speed, error reporting, and input handling:
Performance
Attoparsec is optimized for high-speed parsing of byte arrays (e.g., network protocols). In benchmarks parsing HTTP GET requests, Attoparsec achieved approximately 56% of the speed of a hand-rolled C parser, significantly outperforming standard Parsec 3 implementations.
Error Messages
- Parsec 3: Provides much more user-friendly and descriptive error messages.
- Attoparsec: Prioritizes performance and is specialized for byte arrays; it does not prioritize friendly error messages.
Input Handling and Memory
- Parsec 3: Requires all input to be available upfront, either as a single large chunk or via lazy I/O (which incurs a performance penalty).
- Attoparsec: Uses a continuation-based approach. If there is insufficient data to return a complete result, it returns a continuation that allows you to provide more data. This eliminates the need for lazy I/O or manual buffering and allows for a pure API that is agnostic of the input source.
Clone the attoparsec repository
masterYou can access the master git repository to download the source code directly using git.
git clone https://github.com/haskell/attoparsec.git