You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The standard way to wait in the Haskell IO monad is threadDelay. This works reasonably well, but the type of this action is awkward – integer time in magic-number-micro–seconds. Surely there should be a variant of this with a properly-typed time argument. Since threadDelay is in base, but no suitable time-type, it would seem sensible to put it in a library that defines such a time type – like thyme!
I've just written the following wrapper for my dynamic-plot project (which still uses time though I think I want to switch to thyme soon):
waitTill::UTCTime->IO()
waitTill t =do
tnow <- getCurrentTime
threadDelay .max0.round$ diffUTCTime t tnow
*1e+6-- threadDelay ticks in microseconds
Are there any arguments against adding a module with such “waiter-actions” to thyme?
The text was updated successfully, but these errors were encountered:
The standard way to wait in the Haskell IO monad is threadDelay. This works reasonably well, but the type of this action is awkward – integer time in magic-number-micro–seconds. Surely there should be a variant of this with a properly-typed time argument. Since
threadDelay
is inbase
, but no suitable time-type, it would seem sensible to put it in a library that defines such a time type – likethyme
!I've just written the following wrapper for my dynamic-plot project (which still uses
time
though I think I want to switch tothyme
soon):Are there any arguments against adding a module with such “waiter-actions” to
thyme
?The text was updated successfully, but these errors were encountered: