{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreid6pj25gyi3sefnx2jckmqcoade6fyohm7q4ncoqt32g4xxbvyk2y",
"uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mgnrcuzcbgu2"
},
"path": "/t/ann-type-safe-diffutctime/13778#post_4",
"publishedAt": "2026-03-09T14:08:19.000Z",
"site": "https://discourse.haskell.org",
"tags": [
"unsafeIOToSTM",
"github.com/yaitskov/a-piece-of-flake",
"src/PieceOfFlake/Flake/Repo.hs",
"`16f035a74`"
],
"textContent": "BurningWitness:\n\n> Have you read the documentation to unsafeIOToSTM?\n\nYes, I do. getCurrentTime doesn’t modify anything.\nOtherwise I need to break STM transaction to get time.\nGitHub has bug tracker.\n\nBurningWitness:\n\n> Not clear when this situation might arise, please elaborate.\n\ngithub.com/yaitskov/a-piece-of-flake\n\n#### src/PieceOfFlake/Flake/Repo.hs\n\n`16f035a74`\n\n\n\n\n\n\n 96. (\\(fu, Tagged ifq) -> do\n\n\n 97. addTimeDif fr.repoStats.meanTimeInFetchQueue ifq\n\n\n 98. pure fu)\n\n\n 99.\n\n 100. data TimeInFetchQueue\n\n\n 101.\n\n 102. popFlakeSubmitionStm ::\n\n\n 103. FetcherId ->\n\n\n 104. FlakeRepo ->\n\n\n 105. WriterLoggingT STM (Maybe (FlakeUrl, Tagged TimeInFetchQueue NominalDiffTime))\n\n\n 106. popFlakeSubmitionStm ftid fr = do\n\n\n 107. fSub <- lift $ readTQueue fr.fetcherQueue\n\n\n 108. lift $ modifyTVar' fr.fetcherQueueLen (\\x -> x - 1)\n\n\n 109. fql <- lift $ readTVar fr.fetcherQueueLen\n\n\n 110. $(logInfo) $ \"Fetcher queue decreased to \" <> P.show fql\n\n\n 111. case fSub of\n\n\n 112. Nothing -> pure Nothing\n\n\n 113. Just fu ->\n\n\n 114. lift (lookup fu fr.flakes) >>= \\case\n\n\n 115. Just (SubmittedFlake { flakeUrl, submittedAt })\n\n\n 116. | flakeUrl == fu -> do\n\n\n\n",
"title": "[ANN] type safe diffUTCTime"
}