packages feed

timers 0.2.0.2 → 0.2.0.3

raw patch · 3 files changed

+45/−45 lines, 3 filesdep ~monad-control

Dependency ranges changed: monad-control

Files

src/Control/Concurrent/Timer.hs view
@@ -25,14 +25,14 @@ ------------------------------------------------------------------------------  -- | Attempts to start a timer.--- The started timer will have the given delay and action associated and will be one-shot timer.+-- The started timer will have the given delay and action associated with it and will be one-shot timer. ----- If the timer was already initialized, it the previous timer will be stoped (the thread killed) and the timer will be started anew.+-- If the timer was initialized before it will be stopped (killed) and started anew. ----- Returns True if the strat was successful,+-- Returns True if the start was successful, -- otherwise (e.g. other thread is attempting to manipulate the timer) returns False. oneShotStart :: TimerIO-             -> IO ()  -- ^ The action the timer will start with.+             -> IO () -- ^ The action the timer will start with.              -> Delay -- ^ The dealy the timer will start with.              -> IO Bool oneShotStart (Timer mvmtim) a d = do@@ -49,15 +49,15 @@ {-# INLINEABLE oneShotStart #-}  -- | Attempts to start a timer.--- The started timer will have the given delay and action associated and will be repeated timer.+-- The started timer will have the given delay and action associated with it and will be repeated timer. ----- If the timer was already initialized, it the previous timer will be stoped (the thread killed) and the timer will be started anew.+-- If the timer was initialized before it will be stopped (killed) and started anew. ----- Returns True if the strat was successful,+-- Returns True if the start was successful, -- otherwise (e.g. other thread is attempting to manipulate the timer) returns False. repeatedStart :: TimerIO-              -> IO ()   -- ^ The action the timer will start with.-              -> Delay  -- ^ The dealy the timer will start with.+              -> IO () -- ^ The action the timer will start with.+              -> Delay -- ^ The dealy the timer will start with.               -> IO Bool repeatedStart (Timer mvmtim) a d = do     mtim <- tryTakeMVar mvmtim@@ -73,9 +73,9 @@ {-# INLINEABLE repeatedStart #-}  -- | Attempts to restart already initialized timer.--- The restarted timer will have the same delay and action associated and will be one-shot timer.+-- The restarted timer will have the same delay and action associated with it and will be one-shot timer. ----- Returns True if the restrat was successful,+-- Returns True if the restart was successful, -- otherwise (e.g. other thread is attempting to manipulate the timer or the timer was not initialized) returns False. oneShotRestart :: TimerIO                -> IO Bool@@ -90,9 +90,9 @@ {-# INLINEABLE oneShotRestart #-}  -- | Attempts to restart already initialized timer.--- The restarted timer will have the same delay and action associated and will be one-shot timer.+-- The restarted timer will have the same delay and action associated with it and will be one-shot timer. ----- Returns True if the restrat was successful,+-- Returns True if the restart was successful, -- otherwise (e.g. other thread is attempting to manipulate the timer or the timer was not initialized) returns False. repeatedRestart :: TimerIO                 -> IO Bool@@ -107,15 +107,15 @@ {-# INLINEABLE repeatedRestart #-}  -- | Executes the the given action once after the given delay elapsed, no sooner, maybe later.-oneShotTimer :: IO ()        -- ^ The action to be executed.-             -> Delay      -- ^ The (minimal) time until the execution in microseconds.+oneShotTimer :: IO () -- ^ The action to be executed.+             -> Delay -- ^ The (minimal) time until the execution in microseconds.              -> IO TimerIO oneShotTimer a d = Timer <$> (oneShotTimerImmutable a d >>= newMVar . Just) {-# INLINE oneShotTimer #-}  -- | Executes the the given action repeatedly with at least the given delay between executions.-repeatedTimer :: IO ()    -- ^ The action to be executed.-              -> Delay   -- ^ The (minimal) delay between executions.+repeatedTimer :: IO () -- ^ The action to be executed.+              -> Delay -- ^ The (minimal) delay between executions.               -> IO TimerIO repeatedTimer a d = Timer <$> (repeatedTimerImmutable a d >>= newMVar . Just) {-# INLINE repeatedTimer #-}@@ -140,13 +140,13 @@ -- | Utility  type TimerIO = Timer IO-type TimerImmutableIO = TimerImmutable IO +type TimerImmutableIO = TimerImmutable IO  -- | Forks a new thread that runs the supplied action -- (at least) after the given delay and stores the action, -- delay and thread id in the immutable TimerImmutable value.-oneShotTimerImmutable :: IO ()        -- ^ The action to be executed.-                      -> Delay       -- ^ The (minimal) time until the execution in microseconds.+oneShotTimerImmutable :: IO () -- ^ The action to be executed.+                      -> Delay -- ^ The (minimal) time until the execution in microseconds.                       -> IO TimerImmutableIO oneShotTimerImmutable a d = TimerImmutable a d <$> oneShotAction a d {-# INLINE oneShotTimerImmutable #-}@@ -154,8 +154,8 @@ -- | Forks a new thread that repeats the supplied action -- with (at least) the given delay between each execution and stores the action, -- delay and thread id in the immutable TimerImmutable value.-repeatedTimerImmutable :: IO ()        -- ^ The action to be executed.-                       -> Delay       -- ^ The (minimal) time until the execution in microseconds.+repeatedTimerImmutable :: IO () -- ^ The action to be executed.+                       -> Delay -- ^ The (minimal) time until the execution in microseconds.                        -> IO TimerImmutableIO repeatedTimerImmutable a d = TimerImmutable a d <$> repeatedAction a d {-# INLINE repeatedTimerImmutable #-}
src/Control/Concurrent/Timer/Lifted.hs view
@@ -31,9 +31,9 @@ -- | Attempts to start a timer. -- The started timer will have the given delay and action associated and will be one-shot timer. ----- If the timer was already initialized, it the previous timer will be stoped (the thread killed) and the timer will be started anew.+-- If the timer was initialized before it will be stopped (killed) and started anew. ----- Returns True if the strat was successful,+-- Returns True if the start was successful, -- otherwise (e.g. other thread is attempting to manipulate the timer) returns False. oneShotStart :: MonadBaseControl IO m                => Timer m@@ -56,14 +56,14 @@ -- | Attempts to start a timer. -- The started timer will have the given delay and action associated and will be repeated timer. ----- If the timer was already initialized, it the previous timer will be stoped (the thread killed) and the timer will be started anew.+-- If the timer was initialized before it will be stopped (killed) and started anew. ----- Returns True if the strat was successful,+-- Returns True if the start was successful, -- otherwise (e.g. other thread is attempting to manipulate the timer) returns False. repeatedStart :: MonadBaseControl IO m                 => Timer m-                -> m ()   -- ^ The action the timer will start with.-                -> Delay  -- ^ The dealy the timer will start with.+                -> m ()  -- ^ The action the timer will start with.+                -> Delay -- ^ The dealy the timer will start with.                 -> m Bool repeatedStart (Timer mvmtim) a d = do     mtim <- tryTakeMVar mvmtim@@ -81,7 +81,7 @@ -- | Attempts to restart already initialized timer. -- The restarted timer will have the same delay and action associated and will be one-shot timer. ----- Returns True if the restrat was successful,+-- Returns True if the restart was successful, -- otherwise (e.g. other thread is attempting to manipulate the timer or the timer was not initialized) returns False. oneShotRestart :: MonadBaseControl IO m                => Timer m@@ -98,8 +98,8 @@  -- | Attempts to restart already initialized timer. -- The restarted timer will have the same delay and action associated and will be one-shot timer.--- --- Returns True if the restrat was successful,+--+-- Returns True if the restart was successful, -- otherwise (e.g. other thread is attempting to manipulate the timer or the timer was not initialized) returns False. repeatedRestart :: MonadBaseControl IO m                 => Timer m@@ -116,16 +116,16 @@  -- | Executes the the given action once after the given delay elapsed, no sooner, maybe later. oneShotTimer :: MonadBaseControl IO m-             => m ()        -- ^ The action to be executed.-             -> Delay      -- ^ The (minimal) time until the execution in microseconds.+             => m ()  -- ^ The action to be executed.+             -> Delay -- ^ The (minimal) time until the execution in microseconds.              -> m (Timer m) oneShotTimer a d = Timer <$> (oneShotTimerImmutable a d >>= newMVar . Just) {-# INLINE oneShotTimer #-}  -- | Executes the the given action repeatedly with at least the given delay between executions. repeatedTimer :: MonadBaseControl IO m-              => m ()    -- ^ The action to be executed.-              -> Delay   -- ^ The (minimal) delay between executions.+              => m ()  -- ^ The action to be executed.+              -> Delay -- ^ The (minimal) delay between executions.               -> m (Timer m) repeatedTimer a d = Timer <$> (repeatedTimerImmutable a d >>= newMVar . Just) {-# INLINE repeatedTimer #-}@@ -157,8 +157,8 @@ -- (at least) after the given delay and stores the action, -- delay and thread id in the immutable TimerImmutable value. oneShotTimerImmutable :: MonadBaseControl IO m-                      => m ()        -- ^ The action to be executed.-                      -> Delay       -- ^ The (minimal) time until the execution in microseconds.+                      => m ()  -- ^ The action to be executed.+                      -> Delay -- ^ The (minimal) time until the execution in microseconds.                       -> m (TimerImmutable m) oneShotTimerImmutable a d = TimerImmutable a d <$> oneShotAction a d {-# INLINE oneShotTimerImmutable #-}@@ -167,8 +167,8 @@ -- with (at least) the given delay between each execution and stores the action, -- delay and thread id in the immutable TimerImmutable value. repeatedTimerImmutable :: MonadBaseControl IO m-                       => m ()        -- ^ The action to be executed.-                       -> Delay       -- ^ The (minimal) time until the execution in microseconds.+                       => m ()  -- ^ The action to be executed.+                       -> Delay -- ^ The (minimal) time until the execution in microseconds.                        -> m (TimerImmutable m) repeatedTimerImmutable a d = TimerImmutable a d <$> repeatedAction a d {-# INLINE repeatedTimerImmutable #-}
timers.cabal view
@@ -1,5 +1,5 @@ name:                timers-version:             0.2.0.2+version:             0.2.0.3 synopsis:            Simple package that implements timers. description:         Simple package that implements timers. Both "one-shot" and "repeating" timers are implemented. license:             BSD3@@ -25,11 +25,11 @@         Control.Concurrent.Timer.Types      build-depends:-        base              >= 4.5 && < 5-      , lifted-base       >= 0.1 && < 0.3-      , monad-control     >= 0.3 && < 0.4-      , suspend           >= 0.2 && < 0.3-      , transformers-base >= 0.4 && < 0.5+        base              >= 4.5    && < 5+      , lifted-base       >= 0.1    && < 0.3+      , monad-control     >= 1.0.0  && < 2+      , suspend           >= 0.2    && < 0.3+      , transformers-base >= 0.4    && < 0.5      hs-source-dirs:      src     ghc-options:         -Wall -fwarn-unused-imports