⟨/⟩ AT Protocol Record Source
at://did:plc:pi6woz4d47bkuws673w2il2r/site.standard.document/3mnuwbjuz6462
← Back to post
{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreieavhgaanraj5ubhjboulinjtcvthr2zoln6vcl4lnsa4veav3wj4",
    "uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mnuwbjuz2t62"
  },
  "path": "/t/haskells-missing-mutable-reference-type/14248#post_9",
  "publishedAt": "2026-06-09T17:37:30.000Z",
  "site": "https://discourse.haskell.org",
  "textContent": "Thanks for the feedback!\n\nBurningWitness:\n\n> Okay, I had to spend 40 minutes figuring out what this is, and I’m still not sure.\n\nMaybe the reference implementation in the next article (linked at the top of the current one) will help?\n\nBurningWitness:\n\n> Am I correct to understand that the problem you’re looking to solve is that of a user-definable implicit global context, which can be adjusted locally,\n\nYes.\n\nBurningWitness:\n\n> I assumed if a feature like this were to exist it’d be on the compiler to collect all the “contextual” references upfront.\n\nI’m not sure what that means. Can you elaborate?\n\nBurningWitness:\n\n>\n>     contextual x :: Contextual Int -- still magical\n>     contextual x = 5\n>\n\nFWIW, this is not allowed in my API. I suppose an API that allows it may be reasonable nonetheless.\n\nBurningWitness:\n\n> This wouldn’t be mutable from user perspective, so I wouldn’t bring up `IORef` at all when talking about it.\n\nWhy is it not “mutable from the user perspective”? The value of `x` “mutates” here, doesn’t it?\n\n\n    a <- getContextual x\n    print a\n    overriding x (+2) $ do\n      b <- getContextual x\n      print b\n",
  "title": "Haskell's missing mutable reference type"
}