packages feed

async-extras 0.1.1.0 → 0.1.2.0

raw patch · 3 files changed

+62/−2 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Control.Concurrent.Async.Extra: fixAsyncBound :: (Async a -> IO a) -> IO (Async a)
+ Control.Concurrent.Async.Extra: fixAsyncOn :: Int -> (Async a -> IO a) -> IO (Async a)
+ Control.Concurrent.Async.Extra: fixAsyncOnWithUnmask :: Int -> (Async a -> (forall b. IO b -> IO b) -> IO a) -> IO (Async a)
+ Control.Concurrent.Async.Extra: fixAsyncWithUnmask :: (Async a -> (forall b. IO b -> IO b) -> IO a) -> IO (Async a)
+ Control.Concurrent.Async.Lifted.Extra: fixAsyncBound :: (MonadFix m, MonadBaseControl IO m) => (Async (StM m a) -> m a) -> m (Async (StM m a))
+ Control.Concurrent.Async.Lifted.Extra: fixAsyncOn :: (MonadFix m, MonadBaseControl IO m) => Int -> (Async (StM m a) -> m a) -> m (Async (StM m a))
+ Control.Concurrent.Async.Lifted.Extra: fixAsyncOnWithUnmask :: (MonadFix m, MonadBaseControl IO m) => Int -> (Async (StM m a) -> (forall b. m b -> m b) -> m a) -> m (Async (StM m a))
+ Control.Concurrent.Async.Lifted.Extra: fixAsyncWithUnmask :: (MonadFix m, MonadBaseControl IO m) => (Async (StM m a) -> (forall b. m b -> m b) -> m a) -> m (Async (StM m a))

Files

async-extras.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                async-extras-version:             0.1.1.0+version:             0.1.2.0 synopsis:            Extra Utilities for the Async Library -- description:          homepage:            http://github.com/jfischoff/async-extras
src/Control/Concurrent/Async/Extra.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE RecursiveDo #-} {-# LANGUAGE DeriveFunctor #-}+{-# LANGUAGE RankNTypes #-} module Control.Concurrent.Async.Extra where import Control.Concurrent.Async import Control.Concurrent.STM@@ -30,6 +31,32 @@ fixAsync :: (Async a -> IO a) -> IO (Async a) fixAsync f = mdo      this <- async $ f this+    return this++-- | Like 'fixAsync' but using 'forkOS' internally.+fixAsyncBound :: (Async a -> IO a) -> IO (Async a)+fixAsyncBound f = mdo +    this <- asyncBound $ f this+    return this++-- | Like 'fixAsync' but using 'forkOn' internally.+fixAsyncOn :: Int -> (Async a -> IO a) -> IO (Async a)+fixAsyncOn cpu f = mdo +    this <- asyncOn cpu $ f this+    return this++-- | Like 'fixAsync' but using 'forkIOWithUnmask' internally.+-- The child thread is passed a function that can be used to unmask asynchronous exceptions.+fixAsyncWithUnmask :: (Async a -> (forall b . IO b -> IO b) -> IO a) -> IO (Async a)+fixAsyncWithUnmask f = mdo +    this <- asyncWithUnmask $ f this+    return this++-- | Like 'fixAsyncOn' but using 'forkOnWithUnmask' internally.+-- The child thread is passed a function that can be used to unmask asynchronous exceptions.+fixAsyncOnWithUnmask :: Int -> (Async a -> (forall b . IO b -> IO b) -> IO a) -> IO (Async a)+fixAsyncOnWithUnmask cpu f = mdo +    this <- asyncWithUnmask $ f this     return this  -- | Create an async that is linked to a parent. If the parent
src/Control/Concurrent/Async/Lifted/Extra.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE RankNTypes #-} module Control.Concurrent.Async.Lifted.Extra where import Control.Concurrent.Async.Lifted import Control.Concurrent.STM@@ -40,9 +41,41 @@  -- | Create an 'Async' and pass it to itself. fixAsync :: (MonadFix m, MonadBaseControl IO m) -            => (Async (StM m a) -> m a) -> m (Async (StM m a))+         => (Async (StM m a) -> m a) -> m (Async (StM m a)) fixAsync f = mdo      this <- async $ f this+    return this++-- | Like 'fixAsync' but using 'forkOS' internally.+fixAsyncBound :: (MonadFix m, MonadBaseControl IO m) +              => (Async (StM m a) -> m a) -> m (Async (StM m a))+fixAsyncBound f = mdo +    this <- asyncBound $ f this+    return this++-- | Like 'fixAsync' but using 'forkOn' internally.+fixAsyncOn :: (MonadFix m, MonadBaseControl IO m) +           => Int -> (Async (StM m a) -> m a) -> m (Async (StM m a))+fixAsyncOn cpu f = mdo +    this <- asyncOn cpu $ f this+    return this++-- | Like 'fixAsync' but using 'forkIOWithUnmask' internally.+-- The child thread is passed a function that can be used to unmask asynchronous exceptions.+fixAsyncWithUnmask :: (MonadFix m, MonadBaseControl IO m) +                   => (Async (StM m a) -> (forall b . m b -> m b) -> m a) +                   -> m (Async (StM m a))+fixAsyncWithUnmask f = mdo +    this <- asyncWithUnmask $ f this+    return this++-- | Like 'fixAsyncOn' but using 'forkOnWithUnmask' internally.+-- The child thread is passed a function that can be used to unmask asynchronous exceptions.+fixAsyncOnWithUnmask :: (MonadFix m, MonadBaseControl IO m) +                     => Int -> (Async (StM m a) -> (forall b . m b -> m b) -> m a) +                     -> m (Async (StM m a))+fixAsyncOnWithUnmask cpu f = mdo +    this <- asyncWithUnmask $ f this     return this  -- | Create an async that is linked to a parent. If the parent