{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreih2js6cmczk4rvi4qgjg3f6us4r2in4347so77rvz5i45bwmhnbpa",
    "uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mm7u2tfegvf2"
  },
  "path": "/t/lazily-consuming-a-self-referential-linked-list/14131#post_9",
  "publishedAt": "2026-05-19T16:28:27.000Z",
  "site": "https://discourse.haskell.org",
  "textContent": "Just process the batches explicitly instead of knot-tying?\n\n\n    run :: [q] -> s -> (q -> s -> [q] -> ([q], s)) -> s\n    run initial state action = loop initial state\n      where\n        loop [] s = s\n        loop qs s =\n          case go qs s action of\n            ([], s')   -> s'\n            (qs', s')  -> loop qs' s'\n\n    go :: [q] -> s -> (q -> s -> [q] -> ([q], s)) -> ([q], s)\n    go qs s0 f = case qs of\n      [] -> ([], s0)\n      q:rest ->\n        let\n          (qs1, s1) = f q s0 qs2\n          (qs2, s2) = go rest s1 f\n        in\n          (qs1, s2)\n\n\nNot sure if that’s what you want, it’s a bit hard to tell without examples.\n\nThe code was produced by GPT-5.5.",
  "title": "Lazily consuming a self-referential linked list"
}