{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreiebbs4ucqplcc5pyxshr6wv6t5dfaclbqdvtndrgcxahnhuuhpdcy",
"uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mmai7ikap3b2"
},
"path": "/t/lazily-consuming-a-self-referential-linked-list/14131#post_11",
"publishedAt": "2026-05-19T21:30:34.000Z",
"site": "https://discourse.haskell.org",
"textContent": "Perhaps you just want this?\n\n\n run :: (s -> q -> (s, [q])) -> s -> [q] -> s\n run _ s [] = s\n run f s qs = case mapAccumL f s qs of\n (s', qss) -> run f s' (concat qss)\n\n\nThe concatenation is properly oriented so it’s effectively free.",
"title": "Lazily consuming a self-referential linked list"
}