Reputation: 28470
Upon refining the Haskell notification server I'm experimenting with, I come up with something like this:
import Control.Concurrent (threadDelay)
import Control.Monad (forever)
repeatEvery :: Int -> IO () -> IO ()
repeatEvery time action = forever $ action >> threadDelay time
which can be used like this
repeatEvery oneSec $ do
stuff
and I was wondering if repeatEvery
is exposed by some library.
I haven't found anything like that on Hoogle by searching for a -> f b -> f b
, but maybe the signature is slighly different?
Upvotes: 2
Views: 65