{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreiffuptffyixl522wy3z6pjao6k2y3rh3psu56jz4xkf7alca7nrfi",
    "uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mplaog6yvzt2"
  },
  "path": "/t/ghc-proposal-top-level-io-initialized-bindings/14328?page=2#post_24",
  "publishedAt": "2026-07-01T09:27:59.000Z",
  "site": "https://discourse.haskell.org",
  "textContent": "prophet:\n\n>\n>     blah_impl :: Blurg\n>     blah_impl = unsafePerformIO someEffectfulFunction\n>     {-# OPAQUE blah_impl #-}\n>\n>     blah :: IO Blurg\n>     blah =  pure blah_impl\n>\n\nI like that, but I would instead suggest:\n\n\n    data Box a = Box a\n\n    blah_impl :: Box Blurg\n    blah_impl = unsafePerformIO (Box <$> someEffectFulFunction)\n    {-# OPAQUE blah_impl #-}\n\n    blah :: IO Blurg\n    blah = let !(Box x) = blah_impl in pure x\n\n\nThat way the IO action will run whenever `blah` runs for the first time, not only later when the result of `blah` is forced. And this doesn’t force the `Blurg` itself.",
  "title": "GHC Proposal: Top-level IO initialized bindings"
}