packages feed

async-refresh 0.2.0.2 → 0.3.0.0

raw patch · 4 files changed

+23/−37 lines, 4 filesdep +unliftiodep +unliftio-coredep −monad-controlPVP ok

version bump matches the API change (PVP)

Dependencies added: unliftio, unliftio-core

Dependencies removed: monad-control

API changes (from Hackage documentation)

- Control.Concurrent.Async.Refresh: newAsyncRefresh :: (MonadIO m, MonadBaseControl IO m, MonadCatch m, MonadMask m, MonadLogger m, Forall (Pure m)) => AsyncRefreshConf m a -> m AsyncRefresh
+ Control.Concurrent.Async.Refresh: newAsyncRefresh :: (MonadUnliftIO m, MonadCatch m, MonadMask m, MonadLogger m) => AsyncRefreshConf m a -> m AsyncRefresh

Files

LICENSE view
@@ -1,4 +1,4 @@-Copyright Moritz Schulte (c) 2017+Copyright Moritz Clasmeier (c) 2017, 2018  All rights reserved. 
async-refresh.cabal view
@@ -1,5 +1,5 @@ name:                async-refresh-version:             0.2.0.2+version:             0.3.0.0 synopsis:            Package implementing core logic for refreshing of expiring data. description:         This package can be used for refreshing of expiring data according                      to a user-provided action. Using callbacks, the user can decide@@ -7,9 +7,9 @@ homepage:            https://github.com/mtesseract/async-refresh license:             BSD3 license-file:        LICENSE-author:              Moritz Schulte+author:              Moritz Clasmeier maintainer:          mtesseract@silverratio.net-copyright:           (c) 2017 Moritz Schulte+copyright:           (c) 2017, 2018 Moritz Clasmeier category:            Control build-type:          Simple extra-source-files:  README.md@@ -39,7 +39,8 @@                      , stm                      , safe-exceptions                      , formatting-                     , monad-control+                     , unliftio+                     , unliftio-core  test-suite async-refresh-test   type:                exitcode-stdio-1.0
src/Control/Concurrent/Async/Refresh.hs view
@@ -8,7 +8,7 @@ {-| Module      : Control.Concurrent.Async.Refresh Description : This module exposes the API of the async-refresh package.-Copyright   : (c) Moritz Schulte, 2017+Copyright   : (c) Moritz Clasmeier, 2017-2018 License     : BSD3 Maintainer  : mtesseract@silverratio.net Stability   : experimental@@ -34,11 +34,11 @@   , asyncRefreshAsync   ) where -import           Control.Concurrent.Async.Lifted.Safe     (wait) import qualified Control.Concurrent.Async.Refresh.Lenses  as Lens import           Control.Concurrent.Async.Refresh.Prelude import           Control.Concurrent.Async.Refresh.Types import           Control.Concurrent.Async.Refresh.Util+import           Control.Monad.IO.Unlift import           Lens.Micro  -- | Given a refresh action, create a new configuration.@@ -103,12 +103,10 @@  -- | Start a new thread taking care of refreshing of data according to -- the given configuration.-newAsyncRefresh :: ( MonadIO m-                   , MonadBaseControl IO m+newAsyncRefresh :: ( MonadUnliftIO m                    , MonadCatch m                    , MonadMask m-                   , MonadLogger m-                   , Forall (Pure m) )+                   , MonadLogger m )                 => AsyncRefreshConf m a                 -> m AsyncRefresh newAsyncRefresh conf = AsyncRefresh <$> async (asyncRefreshCtrlThread conf)@@ -116,12 +114,10 @@ -- | Main function of the refresh control thread. Acts as a simple -- watchdog for the thread defined by 'asyncRefreshThread' doing the -- actual work.-asyncRefreshCtrlThread :: ( MonadIO m-                          , MonadBaseControl IO m+asyncRefreshCtrlThread :: ( MonadUnliftIO m                           , MonadCatch m                           , MonadMask m-                          , MonadLogger m-                          , Forall (Pure m) )+                          , MonadLogger m )                        => AsyncRefreshConf m a                        -> m () asyncRefreshCtrlThread conf = do@@ -129,11 +125,9 @@   logErrorN "Unexpected termination of async refresh thread"  -- | Main function for the thread implementing the refreshing logic.-asyncRefreshThread :: ( MonadIO m-                      , MonadBaseControl IO m+asyncRefreshThread :: ( MonadUnliftIO m                       , MonadCatch m-                      , MonadLogger m-                      , Forall (Pure m) )+                      , MonadLogger m )                    => AsyncRefreshConf m a -> m () asyncRefreshThread conf = forever $   tryAny (asyncRefreshDo conf) >>= \case@@ -150,11 +144,9 @@       threadDelay (conf ^. Lens.defaultInterval * 10^3)  -- | This function does the actual refreshing work.-asyncRefreshDo :: ( MonadIO m-                  , MonadBaseControl IO m+asyncRefreshDo :: ( MonadUnliftIO m                   , MonadCatch m-                  , MonadLogger m-                  , Forall (Pure m) )+                  , MonadLogger m )                => AsyncRefreshConf m a -> m (RefreshResult a) asyncRefreshDo conf = do   tryA <- tryAny (conf ^. Lens.action)
src/Control/Concurrent/Async/Refresh/Prelude.hs view
@@ -13,31 +13,28 @@   , module Control.Exception.Safe   , module Formatting   , module Control.Monad.Logger+  , module UnliftIO.Async+  , threadDelay   , Text   , fromMaybe-  , Async, Forall, Pure, withAsync, async-  , threadDelay   , forever, void   , MonadIO-  , MonadBaseControl   , undefined   , tshow   ) where -import qualified Control.Concurrent-import           Control.Concurrent.Async.Lifted.Safe import           Control.Exception.Safe import           Control.Monad import           Control.Monad.IO.Class import           Control.Monad.Logger-import           Control.Monad.Trans.Control-import           Data.Maybe                           (fromMaybe)-import           Data.Text                            (Text)+import           Data.Maybe             (fromMaybe)+import           Data.Text              (Text) import qualified Data.Text import           Formatting-import           Prelude                              hiding (head, tail,-                                                       undefined)+import           Prelude                hiding (head, tail, undefined) import qualified Prelude+import           UnliftIO.Async+import           UnliftIO.Concurrent  -- | Version of 'undefined' with a deprecated pragma. undefined :: a@@ -48,7 +45,3 @@ -- 'String'. tshow :: Show a => a -> Text tshow = Data.Text.pack . show---- | Generalization of 'Control.Concurrent.threadDelay'.-threadDelay :: MonadIO m => Int -> m ()-threadDelay = liftIO . Control.Concurrent.threadDelay