{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreihkx2v5kvghybko2tqqrm6y4q3k7e3jng6cyjt5gycmfm2kegmk2y",
"uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mnubtv2kif62"
},
"path": "/t/haskells-missing-mutable-reference-type/14248#post_2",
"publishedAt": "2026-06-09T11:32:09.000Z",
"site": "https://discourse.haskell.org",
"textContent": "So, I’m guessing the use case here is that you have a computation that already somehow captures the `IOScopedRef`, as in\n\n\n do\n ref <- newIOScopedRef 0\n let printCurrent = do\n current <- readIOScopedRef ref\n print current\n modifyScopedIORef ref (+1) do\n ...\n printCurrent -- implicitly uses the captured 'ref'\n\n\n(otherwise I’m not sure how this would be different from just using a regular variable and shadowing it)\n\nDo you have an example where this is useful to have?",
"title": "Haskell's missing mutable reference type"
}