⟨/⟩ AT Protocol Record Source
at://did:plc:pi6woz4d47bkuws673w2il2r/site.standard.document/3mnwfaa7j7pi2
← Back to post
{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreic2jwsbzty46xanxz24idy4hvto3rjvkgeffqlgbfpzodihakmm24",
    "uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mnwfaa7j6ri2"
  },
  "path": "/t/haskells-missing-mutable-reference-type/14248#post_20",
  "publishedAt": "2026-06-10T08:14:07.000Z",
  "site": "https://discourse.haskell.org",
  "textContent": "tomjaguarpaw:\n\n> Well, I explained how I can get my API from yours.\n\nYes, and I explained that I have no idea what “reading from the `vault`” would look like. I’m essentially getting\n\n\n    contextual vault :: Contextual Vault\n\n    foo :: IO ()\n    foo = do\n      a <- _ vault\n      print a\n\n    ---\n\n    main =\n      withScopedIORef vault 5 $ \\x ->\n        overriding x (+2) $\n          foo\n\n\nwith the questions:\n\n  * How is `foo` expected to access `x` without breaking type safety? Passing a key is not an answer, that’s still data.\n\n  * What happens if `main = foo`?\n\n\n\n\nI guess you could solve both of these if `IO` is an effect that carries `x` at the type level, but that would require proper type-level programming implemented first.",
  "title": "Haskell's missing mutable reference type"
}