{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreifzvi4a27qjuydd2j4tagkhjrcoslafihy45wm7db5u3g7qwgorti",
    "uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mlbplke3o7s2"
  },
  "path": "/t/how-to-parse-specific-syntax-elements-and-discard-the-rest/14047#post_4",
  "publishedAt": "2026-05-07T16:44:10.000Z",
  "site": "https://discourse.haskell.org",
  "tags": [
    "flatparse"
  ],
  "textContent": "VegOwOtenks:\n\n>\n>     findAll :: Parser a -> Text -> [(a, Word)]\n>\n\nYou can also just do something like:\n\n\n    findAll :: Parser a -> Parser [a]\n    findAll p = p <|> anyChar *> findAll p\n\n\n(Note that this assumes that your parser combinator library backtracks, some popular ones like parsec and megaparsec require manual `try` annotations around the first `p`.)\n\nVegOwOtenks:\n\n> Efficiency is always questionable when using parser combinators.\n>  You are probably a lot better off hand-writing some pattern-matching/parsing code over the input string if performance starts mattering (or does already).\n\nOr use flatparse, it generally is as fast as handwritten loops, unless you start doing fancy things with it.",
  "title": "How to parse specific syntax elements and discard the rest?"
}