Hello community,

here is the log from the commit of package ghc-auto-update for openSUSE:Factory 
checked in at 2016-05-17 17:14:26
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-auto-update (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-auto-update.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-auto-update"

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-auto-update/ghc-auto-update.changes  
2016-04-30 23:30:12.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-auto-update.new/ghc-auto-update.changes     
2016-05-17 17:14:27.000000000 +0200
@@ -1,0 +2,6 @@
+Wed May 11 15:05:19 UTC 2016 - mimi...@gmail.com
+
+- update to 0.1.4
+* Provide updateActionModify API in AutoUpdate
+
+-------------------------------------------------------------------

Old:
----
  auto-update-0.1.3.1.tar.gz

New:
----
  auto-update-0.1.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-auto-update.spec ++++++
--- /var/tmp/diff_new_pack.drAdqL/_old  2016-05-17 17:14:28.000000000 +0200
+++ /var/tmp/diff_new_pack.drAdqL/_new  2016-05-17 17:14:28.000000000 +0200
@@ -19,7 +19,7 @@
 %global pkg_name auto-update
 
 Name:           ghc-auto-update
-Version:        0.1.3.1
+Version:        0.1.4
 Release:        0
 Summary:        Efficiently run periodic, on-demand actions
 License:        MIT

++++++ auto-update-0.1.3.1.tar.gz -> auto-update-0.1.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/auto-update-0.1.3.1/ChangeLog.md 
new/auto-update-0.1.4/ChangeLog.md
--- old/auto-update-0.1.3.1/ChangeLog.md        2016-04-25 15:26:28.000000000 
+0200
+++ new/auto-update-0.1.4/ChangeLog.md  2016-05-09 07:43:44.000000000 +0200
@@ -1,3 +1,7 @@
+## 0.1.4
+
+* Provide updateActionModify API in AutoUpdate 
[#547](https://github.com/yesodweb/wai/pull/547)
+
 ## 0.1.3.1
 
 * Doc improvements
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/auto-update-0.1.3.1/Control/AutoUpdate.hs 
new/auto-update-0.1.4/Control/AutoUpdate.hs
--- old/auto-update-0.1.3.1/Control/AutoUpdate.hs       2016-04-24 
15:33:08.000000000 +0200
+++ new/auto-update-0.1.4/Control/AutoUpdate.hs 2016-05-09 07:43:44.000000000 
+0200
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
 -- | In a multithreaded environment, running actions on a regularly scheduled
 -- background thread can dramatically improve performance.
 -- For example, web servers need to return the current time with each HTTP 
response.
@@ -37,12 +38,17 @@
     , updateSpawnThreshold
       -- * Creation
     , mkAutoUpdate
+    , mkAutoUpdateWithModify
     ) where
 
+#if __GLASGOW_HASKELL__ < 709
+import           Control.Applicative     ((<*>))
+#endif
 import           Control.Concurrent      (forkIO, threadDelay)
 import           Control.Concurrent.MVar (newEmptyMVar, putMVar, readMVar,
                                           takeMVar, tryPutMVar)
-import           Control.Exception       (SomeException, catch, throw, mask_, 
try)
+import           Control.Exception       (SomeException, catch, mask_, throw,
+                                          try)
 import           Control.Monad           (void)
 import           Data.IORef              (newIORef, readIORef, writeIORef)
 
@@ -97,7 +103,18 @@
 --
 -- @since 0.1.0
 mkAutoUpdate :: UpdateSettings a -> IO (IO a)
-mkAutoUpdate us = do
+mkAutoUpdate us = mkAutoUpdateHelper us Nothing
+
+-- | Generate an action which will either read from an automatically
+-- updated value, or run the update action in the current thread if
+-- the first time or the provided modify action after that.
+--
+-- @since 0.1.4
+mkAutoUpdateWithModify :: UpdateSettings a -> (a -> IO a) -> IO (IO a)
+mkAutoUpdateWithModify us f = mkAutoUpdateHelper us (Just f)
+
+mkAutoUpdateHelper :: UpdateSettings a -> Maybe (a -> IO a) -> IO (IO a)
+mkAutoUpdateHelper us updateActionModify = do
     -- A baton to tell the worker thread to generate a new value.
     needsRunning <- newEmptyMVar
 
@@ -140,12 +157,12 @@
         -- This infinite loop makes up out worker thread. It takes an a
         -- responseVar value where the next value should be putMVar'ed to for
         -- the benefit of any requesters currently blocked on it.
-        let loop responseVar = do
+        let loop responseVar maybea = do
                 -- block until a value is actually needed
                 takeMVar needsRunning
 
                 -- new value requested, so run the updateAction
-                a <- catchSome $ updateAction us
+                a <- catchSome $ maybe (updateAction us) id 
(updateActionModify <*> maybea)
 
                 -- we got a new value, update currRef and lastValue
                 writeIORef currRef $ Right a
@@ -160,10 +177,10 @@
                 -- variable.
                 responseVar' <- newEmptyMVar
                 writeIORef currRef $ Left responseVar'
-                loop responseVar'
+                loop responseVar' (Just a)
 
         -- Kick off the loop, with the initial responseVar0 variable.
-        loop responseVar0
+        loop responseVar0 Nothing
 
     return $ do
         mval <- readIORef currRef
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/auto-update-0.1.3.1/auto-update.cabal 
new/auto-update-0.1.4/auto-update.cabal
--- old/auto-update-0.1.3.1/auto-update.cabal   2016-04-25 15:26:32.000000000 
+0200
+++ new/auto-update-0.1.4/auto-update.cabal     2016-05-09 07:43:44.000000000 
+0200
@@ -1,5 +1,5 @@
 name:                auto-update
-version:             0.1.3.1
+version:             0.1.4
 synopsis:            Efficiently run periodic, on-demand actions
 description:         API docs and the README are available at 
<http://www.stackage.org/package/auto-update>.
 homepage:            https://github.com/yesodweb/wai


Reply via email to