{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreiaval4vr35nxb2ylrcacuvk6mnn6m5eu5rdanbf4hi42iqa5x26d4",
    "uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mo7d2mefewt2"
  },
  "path": "/t/haskells-missing-mutable-reference-type/14248?page=2#post_38",
  "publishedAt": "2026-06-13T21:59:23.000Z",
  "site": "https://discourse.haskell.org",
  "textContent": "tomjaguarpaw:\n\n> In which case, the response would be that the lexical scoping way is not sufficient to integrate with `libFun`\n\nYes, that is what I was asking for thanks!\n\nOkay, I don’t disagree that the `IOScopedRef` API allows APIs that aren’t possible without it, but I’m still not convinced that those APIs are _useful_.\nYour `libFun` example is techinically an example where they are necessary, because it’s basically a function that takes something with your exact API as a parameter. But then the question is: are there real functions that look like `libFun`? I can’t think of any but maybe you know some?\n\nIn particular, the exact constraint `libFun` has that’s relevant here is that it takes a function from `IO _ -> IO _`, where this function has to act on exactly `IO`.\n\nIf you generalized it to work on any `m` that implements `MonadIO` (Or `MonadUnliftIO`), you wouldn’t need `IOScopedRef`s because you could instantiate `m` with `ReaderT Logger IO`",
  "title": "Haskell's missing mutable reference type"
}