[ANN] type safe diffUTCTime
Haskell Community [Unofficial]
March 9, 2026
BurningWitness:
Have you read the documentation to unsafeIOToSTM?
Yes, I do. getCurrentTime doesn’t modify anything. Otherwise I need to break STM transaction to get time. GitHub has bug tracker.
BurningWitness:
Not clear when this situation might arise, please elaborate.
github.com/yaitskov/a-piece-of-flake
src/PieceOfFlake/Flake/Repo.hs
16f035a74
96. (\(fu, Tagged ifq) -> do
97. addTimeDif fr.repoStats.meanTimeInFetchQueue ifq
98. pure fu)
99.
100. data TimeInFetchQueue
101.
102. popFlakeSubmitionStm ::
103. FetcherId ->
104. FlakeRepo ->
105. WriterLoggingT STM (Maybe (FlakeUrl, Tagged TimeInFetchQueue NominalDiffTime))
106. popFlakeSubmitionStm ftid fr = do
107. fSub <- lift $ readTQueue fr.fetcherQueue
108. lift $ modifyTVar' fr.fetcherQueueLen (\x -> x - 1)
109. fql <- lift $ readTVar fr.fetcherQueueLen
110. $(logInfo) $ "Fetcher queue decreased to " <> P.show fql
111. case fSub of
112. Nothing -> pure Nothing
113. Just fu ->
114. lift (lookup fu fr.flakes) >>= \case
115. Just (SubmittedFlake { flakeUrl, submittedAt })
116. | flakeUrl == fu -> do
Discussion in the ATmosphere