Welcome to attoparsec

attoparsec is a fast Haskell parser combinator library, aimed particularly at dealing efficiently with network protocols and complicated text/binary file formats.

Join in!

I'm happy to receive bug reports, fixes, documentation enhancements, and other improvements.

Please report bugs via the github issue tracker.

Master git repository:

  • git clone git://github.com/bos/attoparsec.git


This library is written and maintained by Bryan O'Sullivan, .


  • runScanner now correctly returns the final state (https://github.com/bos/attoparsec/issues/105).
  • Parser, ZeptoT, Buffer, and More now expose Semigroup instances.
  • Parser, and ZeptoT now expose MonadFail instances.

  • Restore the fast specialised character set implementation for Text
  • Move testsuite from test-framework to tasty
  • Performance optimization of takeWhile and takeWhile1

  • Fixed a bug in the implementations of inClass and notInClass for Text (https://github.com/bos/attoparsec/issues/103)

  • Made the parser type in the Zepto module a monad transformer (needed by aeson's string unescaping parser).

  • Fixed a case folding bug in the ByteString version of stringCI.

  • Fixed an indexing bug in the new Text implementation of string, reported by Michel Boucey.

  • Fixed a case where the string parser would consume an unnecessary amount of input before failing a match, when it could bail much earlier (https://github.com/bos/attoparsec/issues/97)

  • Added more context to error messages (https://github.com/bos/attoparsec/pull/79)

  • Fixed incorrect tracking of Text lengths (https://github.com/bos/attoparsec/issues/80)

  • Fixed the incorrect tracking of capacity if the initial buffer was empty (https://github.com/bos/attoparsec/issues/75)

  • Fixed a data corruption bug that occurred under some circumstances if a buffer grew after prompting for more input (https://github.com/bos/attoparsec/issues/74)

  • Now compatible with GHC 7.9

  • Reintroduced the Chunk class, used by the parsers package

  • A new internal representation makes almost all real-world parsers faster, sometimes by big margins. For example, parsing JSON data with aeson is now up to 70% faster. These performance improvements also come with reduced memory consumption and some new capabilities.

  • The new match combinator gives both the result of a parse and the input that it matched.

  • The test suite has doubled in size. This made it possible to switch to the new internal representation with a decent degree of confidence that everything was more or less working.

  • The benchmark suite now contains a small family of benchmarks taken from real-world uses of attoparsec.

  • A few types that ought to have been private now are.

  • A few obsolete modules and functions have been marked as deprecated. They will be removed from the next major release.

  • New function scientific is compatible with rational, but parses integers more efficiently (https://github.com/bos/aeson/issues/198)

  • The new Chunk typeclass allows for some code sharing with Ed Kmett's parsers package: http://hackage.haskell.org/package/parsers

  • New function runScanner generalises scan to return the final state of the scanner as well as the input consumed.

  • New dependency: the scientific package. This allows us to parse numbers much more efficiently.

  • peekWord8', peekChar': new primitive parsers that allow single-character lookahead.

Used by 594 packages:
3dmodels, AesonBson, AttoBencode, AttoJson, BiobaseInfernal, BiobaseNewick, Combinatorrent, CurryDB, FastxPipe, HDBC-postgresql-hstore, HSmarty, HongoDB, HulkImport, IPv6Addr, JSON-Combinator, JSONb, JsonGrammar, NXTDSL, NaturalLanguageAlphabets, PageIO, QuasiText, QuickPlot, Quickson, STL, SVGFonts, SimpleLog, Spintax, URLb, WaveFront, WordAlignment, abnf, accelerate-examples, ace, aeson, aeson-bson, aeson-compat, aeson-extra, aeson-native, aeson-pretty, aeson-qq, aeson-quick, aeson-schema, aeson-streams, aeson-utils, airship, amazonka-core, api-tools, apotiki, arx, ascii-vector-avc, attic-schedule, atto-lisp, attoparsec-arff, attoparsec-binary, attoparsec-csv, attoparsec-data, attoparsec-enumerator, attoparsec-expr, attoparsec-iteratee, attoparsec-parsec, attoparsec-text, attoparsec-time, attoparsec-trans, attosplit, authenticate, authinfo-hs, avers, avwx, awesomium, aws, aws-dynamodb-streams, aws-general, azure-acs, azure-servicebus, banwords, battleships, bencoding, betacode, bgmax, biohazard, biostockholm, bitcoin-rpc, boolean-like, borel, buildwrapper, bytestring-conversion, bytestring-from, bytestring-time, cab, cake3, campfire, cases, cassava, cassy, cayley-client, chesshs, chronos, cjk, clash-lib, clckwrks, clckwrks-plugin-bugs, clckwrks-plugin-ircbot, clckwrks-plugin-media, clckwrks-plugin-page, clogparse, comma, conduit-extra, conduit-find, conduit-tokenize-attoparsec, configuration-tools, configurator, configurator-ng, confsolve, couch-hs, couch-simple, couchdb-conduit, couchdb-enumerator, cpuinfo, credentials-cli, cron, cron-compat, crypto-pubkey-openssh, css-syntax, css-text, csv-conduit, csv-enumerator, cypher, d-bus, damnpacket, danibot, darcs, darcs-fastconvert, data-named, dataurl, delimited-text, dictionaries, diff-parse, dingo-core, dns, doccheck, dockercook, dot-linker, dsmc, dtd, dtd-text, dustme, email-header, email-postmark, email-validate, emailparse, engine-io, engine-io-wai, env-parser, ert, esotericbot, ez-couch, factual-api, fasta, fastirc, fb, fibon, find-conduit, fit, fixedwidth-hs, fixhs, float-binstring, foldl-transduce-attoparsec, fpco-api, frontmatter, ftp-client, gcodehs, gender, generic-aeson, ghc-prof, ghc-time-alloc-prof, ghcjs-base-stub, git-object, glabrous, gli, glirc, gogol-core, googleplus, gopher-proxy, gpx-conduit, graphql, graphql-api, groundhog, groundhog-postgresql, hMollom, hOpenPGP, hRESP, hack2-handler-mongrel2-http, hackage-diff, hackage-server, hadoop-formats, hadoop-rpc, hadoop-tools, haiji, haskdeep, haskell-gi, haskell-tor, hasmin, hasql, hasql-postgres, hats, hbeanstalk, hchesslib, hdbc-postgresql-hstore, hdbi, hdbi-postgresql, hedn, heist, hgithub, himpy, hirt, hit, hoodle-core, hoodle-extra, hoodle-parser, hoodle-publish, hopenpgp-tools, hops, hosc-json, hostname-validate, hosts-server, hp2any-core, hp2pretty, hpdft, hruby, hs-pkpass, hsbc, hsdev, hsimport, hslogger-reader, hslogstash, hsnsq, hsoz, hspec-attoparsec, hsrelp, hstorchat, hstradeking, html-email-validate, html-entities, html-parse, html-tokenizer, http-attoparsec, http-date, http-enumerator, http-grammar, http-link-header, http-pony-serve-wai, http-pony-transformer-http, http-pony-transformer-startline, http-streams, https-everywhere-rules, hw-json, hw-json-lens, hw-parser, hw-succinct, hw-xml, hweblib, hworker, hyperpublic, ib-api, ical, ide-backend, ide-backend-common, ihttp, imap, influxdb, ini, inject, inserts, io-streams, io-streams-haproxy, ip, irc, irc-bytestring, irc-core, irc-dcc, iterIO, jmacro-rpc, jobqueue, jose, jose-jwt, jsaddle, json-fu, json-incremental-decoder, json-pointer, json-rpc, json-togo, json-tools, jsonextfilter, jsonrpc-conduit, jsonsql, jsontsv, jsonxlsx, karver, keenser, keter, kevin, kit, laika, lambdiff, language-openscad, language-puppet, legion-discovery, legion-extra, leksah-server, lens-aeson, libjenkins, libmpd, librato, libstackexchange, lio-simple, liquid, liquid-fixpoint, list-t-attoparsec, llvm-tools, lmonad-yesod, lss, ltext, luachunk, macbeth-lib, magicbane, mailchimp, makefile, mangopay, markdown, markdown-kate, marquise, matrix-market-attoparsec, memcache-conduit, memcache-haskell, meminfo, merge-bash-history, microformats2-parser, microlens-aeson, midi-simple, moesocks, mole, mongrel2-handler, mqtt, mqtt-hs, mtgoxapi, multiaddr, multihash, mysql-simple, mystem, nagios-perfdata, nc-indicators, ndjson-conduit, nested-routes, netpbm, network-anonymous-i2p, network-anonymous-tor, network-api-support, network-attoparsec, network-bitcoin, network-pgi, neural, ngrams-loader, notmuch-web, ntrip-client, oidc-client, opaleye, open-symbology, openpgp-asciiarmor, optparse-applicative-simple, organize-imports, orgmode-parse, orgstat, osc, ot, pandoc-citeproc, parco-attoparsec, parse-help, parsers, pcd-loader, pcre-utils, pdf-toolbox-content, pdf-toolbox-core, persistent, persistent-audit, persistent-mongoDB, persistent-parser, persistent-redis, persistent-zookeeper, pg, pg-store, pgsql-simple, pgstream, pianola, pipes-aeson, pipes-attoparsec, pipes-attoparsec-streaming, pipes-fastx, pipes-files, planar-graph, playlists, playlists-http, ply-loader, pontarius-xmpp, postgresql-query, postgresql-simple, postgresql-simple-bind, postgresql-typed, postie, postmark, postmark-streams, proc-net, processor-creative-kit, procstat, proto-lens, pseudo-boolean, push-notify-ccs, python-pickle, qif, quack, quickson, raft, rakhana, rdf, readme-lhs, redis-io, redis-resp, rei, relapse, replicant, resolve, rethinkdb, rethinkdb-wereHamster, riak, ripple, ripple-federation, rison, robots-txt, romkan, roshask, rosmsg, route-generator, rtorrent-rpc, sarsi, scalable-server, scanner-attoparsec, scholdoc-citeproc, scion-browser, scp-streams, scrape-changes, second-transfer, semver, seqloc, seqloc-datafiles, serf, servant, servant-auth-hmac, servant-client, servant-haxl-client, servant-server, servant-snap, servant-subscriber, sexp, simple, simple-templates, sindre, siphon, skeleton, skylighting, skype4hs, skypelogexport, sloane, smallcaps, smtlib2-pipe, smtp-mail-ng, smtps-gmail, snap, snap-core, snap-cors, snap-language, snap-predicates, snap-server, snaplet-auth-acid, snaplet-sqlite-simple-jwt-auth, snaplet-wordpress, socket-io, socketio, sourcemap, sproxy, sqlite-simple, sscgi, sssp, stack, stackage-sandbox, stash, stomp-queue, stompl, streaming-utils, strelka, string-random, stutter, subtitleParser, svg-tree, svm-light-utils, svndump, swearjure, syntax-attoparsec, syntax-example, syntax-example-json, tablize, tag-stream, taggy, tagstream-conduit, tai64, tamarin-prover-term, task, templater, terminfo-hs, texrunner, text-ldap, text-regex-replace, text-time, th-printf, thrift, thyme, time-exts, time-http, time-warp, timeparsers, timerep, tinyMesh, tiphys, tkyprof, tnet, toml, trajectory, tremulous-query, tsvsql, twentefp-websockets, twill, twitter-conduit, twitter-enumerator, unicoder, uniform-io, units-attoparsec, unjson, uploadcare, uri-bytestring, usb-hid, utc, vado, vaultaire-common, vgrep, vigilance, wai-app-file-cgi, wai-cors, wai-handler-devel, wai-predicates, wai-routing, warc, wavefront, wavefront-obj, wcwidth, weather-api, web3, webcrank, webdriver, webdriver-snoy, websockets, wikicfp-scraper, wobsurv, wreq, wreq-sb, xcffib, xlsior, xml-conduit, xml-enumerator, xml2json, xournal-parser, xsd, xss-sanitize, yahoo-finance-conduit, yaml, yate, yesod-bin, yesod-csp, yesod-datatables, yesod-form, yesod-routes-flow, yesod-routes-typescript, yesod-static, yesod-test, yi-core, yi-keymap-vim, yxdb-utils
comments powered byDisqus