packages feed

monad-extras 0.3.1.0 → 0.3.2.0

raw patch · 2 files changed

+48/−2 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Control.Concurrent.Delay: delayDays :: Integer -> IO ()
+ Control.Concurrent.Delay: delayHours :: Integer -> IO ()
+ Control.Concurrent.Delay: delayMicrosecs :: Integer -> IO ()
+ Control.Concurrent.Delay: delayMillisecs :: Integer -> IO ()
+ Control.Concurrent.Delay: delayMinutes :: Integer -> IO ()
+ Control.Concurrent.Delay: delaySeconds :: Integer -> IO ()

Files

+ Control/Concurrent/Delay.hs view
@@ -0,0 +1,46 @@+-- | Delay the current thread with an unbound number of milliseconds.++module Control.Concurrent.Delay+  (delayMicrosecs+  ,delayMillisecs+  ,delaySeconds+  ,delayMinutes+  ,delayHours+  ,delayDays+  ) where++import Control.Concurrent++-- | Suspends the current thread for a given number of microseconds.+--+-- There is no guarantee that the thread will be rescheduled promptly+-- when the delay has expired, but the thread will never continue to+-- run earlier than specified.+delayMicrosecs :: Integer -> IO ()+delayMicrosecs microsecs+  | microsecs <= fromIntegral maxMicrosecs = threadDelay (fromIntegral microsecs)+  | otherwise = do+    threadDelay maxMicrosecs+    delayMicrosecs (microsecs - fromIntegral maxMicrosecs)++  where maxMicrosecs = maxBound :: Int++-- | Delay the current thread for at least n milliseconds.+delayMillisecs :: Integer -> IO ()+delayMillisecs = delayMicrosecs . (*1000)++-- | Delay the current thread for at least n seconds.+delaySeconds :: Integer -> IO ()+delaySeconds = delayMillisecs . (* 1000)++-- | Delay the current thread for at least n minutes.+delayMinutes :: Integer -> IO ()+delayMinutes = delaySeconds . (*60)++-- | Delay the current thread for at least n hours.+delayHours :: Integer -> IO ()+delayHours = delayMinutes . (*60)++-- | Delay the current thread for at least n days.+delayDays :: Integer -> IO ()+delayDays = delayHours . (*24)
monad-extras.cabal view
@@ -1,5 +1,5 @@ name:           monad-extras-version:        0.3.1.0+version:        0.3.2.0 synopsis:       Extra utility functions for working with monads -- description: homepage:       http://github.com/jwiegley/monad-extras@@ -15,7 +15,7 @@ library     default-language: Haskell98     exposed-modules:-        Control.Monad.Extra+        Control.Monad.Extra, Control.Concurrent.Delay     build-depends:         base >= 4 && < 5       , transformers