-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Run lifted IO operations asynchronously and wait for their results
--   
--   This package provides IO operations from <tt>async</tt> package lifted
--   to any instance of <a>MonadBase</a> or <a>MonadBaseControl</a>.
@package lifted-async
@version 0.2.0.1


-- | This is a wrapped version of <a>Control.Concurrent.Async</a> with
--   types generalized from <a>IO</a> to all monads in either
--   <a>MonadBase</a> or <a>MonadBaseControl</a>.
module Control.Concurrent.Async.Lifted

-- | An asynchronous action spawned by <a>async</a> or <a>withAsync</a>.
--   Asynchronous actions are executed in a separate thread, and operations
--   are provided for waiting for asynchronous actions to complete and
--   obtaining their results (see e.g. <a>wait</a>).
data Async a :: * -> *

-- | Generalized version of <a>async</a>.
async :: MonadBaseControl IO m => m a -> m (Async (StM m a))

-- | Generalized version of <a>asyncBound</a>.
asyncBound :: MonadBaseControl IO m => m a -> m (Async (StM m a))

-- | Generalized version of <a>asyncOn</a>.
asyncOn :: MonadBaseControl IO m => Int -> m a -> m (Async (StM m a))

-- | Generalized version of <a>asyncWithUnmask</a>.
asyncWithUnmask :: MonadBaseControl IO m => ((forall b. m b -> m b) -> m a) -> m (Async (StM m a))

-- | Generalized version of <a>asyncOnWithUnmask</a>.
asyncOnWithUnmask :: MonadBaseControl IO m => Int -> ((forall b. m b -> m b) -> m a) -> m (Async (StM m a))

-- | Generalized version of <a>withAsync</a>.
withAsync :: MonadBaseControl IO m => m a -> (Async (StM m a) -> m b) -> m b

-- | Generalized version of <a>withAsyncBound</a>.
withAsyncBound :: MonadBaseControl IO m => m a -> (Async (StM m a) -> m b) -> m b

-- | Generalized version of <a>withAsyncOn</a>.
withAsyncOn :: MonadBaseControl IO m => Int -> m a -> (Async (StM m a) -> m b) -> m b

-- | Generalized version of <a>withAsyncWithUnmask</a>.
withAsyncWithUnmask :: MonadBaseControl IO m => ((forall c. m c -> m c) -> m a) -> (Async (StM m a) -> m b) -> m b

-- | Generalized version of <a>withAsyncOnWithUnmask</a>.
withAsyncOnWithUnmask :: MonadBaseControl IO m => Int -> ((forall c. m c -> m c) -> m a) -> (Async (StM m a) -> m b) -> m b

-- | Generalized version of <a>wait</a>.
wait :: MonadBaseControl IO m => Async (StM m a) -> m a

-- | Generalized version of <a>poll</a>.
poll :: MonadBaseControl IO m => Async (StM m a) -> m (Maybe (Either SomeException a))

-- | Generalized version of <a>waitCatch</a>.
waitCatch :: MonadBaseControl IO m => Async (StM m a) -> m (Either SomeException a)

-- | Generalized version of <a>cancel</a>.
cancel :: MonadBase IO m => Async (StM m a) -> m ()

-- | Generalized version of <a>cancelWith</a>.
cancelWith :: (MonadBase IO m, Exception e) => Async (StM m a) -> e -> m ()

-- | Returns the <a>ThreadId</a> of the thread running the given
--   <a>Async</a>.
asyncThreadId :: Async a -> ThreadId

-- | A version of <a>wait</a> that can be used inside an STM transaction.
waitSTM :: Async a -> STM a

-- | A version of <a>poll</a> that can be used inside an STM transaction.
pollSTM :: Async a -> STM (Maybe (Either SomeException a))

-- | A version of <a>waitCatch</a> that can be used inside an STM
--   transaction.
waitCatchSTM :: Async a -> STM (Either SomeException a)

-- | Generalized version of <a>waitAny</a>.
waitAny :: MonadBaseControl IO m => [Async (StM m a)] -> m (Async (StM m a), a)

-- | Generalized version of <a>waitAnyCatch</a>.
waitAnyCatch :: MonadBaseControl IO m => [Async (StM m a)] -> m (Async (StM m a), Either SomeException a)

-- | Generalized version of <a>waitAnyCancel</a>.
waitAnyCancel :: MonadBase IO m => [Async a] -> m (Async a, a)

-- | Generalized version of <a>waitAnyCatchCancel</a>.
waitAnyCatchCancel :: MonadBaseControl IO m => [Async (StM m a)] -> m (Async (StM m a), Either SomeException a)

-- | Generalized version of <a>waitEither</a>.
waitEither :: MonadBaseControl IO m => Async (StM m a) -> Async (StM m b) -> m (Either a b)

-- | Generalized version of <a>waitEitherCatch</a>.
waitEitherCatch :: MonadBaseControl IO m => Async (StM m a) -> Async (StM m b) -> m (Either (Either SomeException a) (Either SomeException b))

-- | Generalized version of <a>waitEitherCancel</a>.
waitEitherCancel :: MonadBaseControl IO m => Async (StM m a) -> Async (StM m b) -> m (Either a b)

-- | Generalized version of <a>waitEitherCatchCancel</a>.
waitEitherCatchCancel :: MonadBaseControl IO m => Async (StM m a) -> Async (StM m b) -> m (Either (Either SomeException a) (Either SomeException b))

-- | Generalized version of <a>waitEither_</a>.
waitEither_ :: MonadBaseControl IO m => Async (StM m a) -> Async (StM m b) -> m ()

-- | Generalized version of <a>waitBoth</a>.
waitBoth :: MonadBaseControl IO m => Async (StM m a) -> Async (StM m b) -> m (a, b)

-- | Generalized version of <a>link</a>.
link :: MonadBase IO m => Async (StM m a) -> m ()

-- | Generalized version of <a>link2</a>.
link2 :: MonadBase IO m => Async (StM m a) -> Async (StM m b) -> m ()

-- | Generalized version of <a>race</a>.
race :: MonadBaseControl IO m => m a -> m b -> m (Either a b)

-- | Generalized version of <a>race_</a>.
race_ :: MonadBaseControl IO m => m a -> m b -> m ()

-- | Generalized version of <a>concurrently</a>.
concurrently :: MonadBaseControl IO m => m a -> m b -> m (a, b)

-- | Generalized version of <a>mapConcurrently</a>.
mapConcurrently :: (Traversable t, MonadBaseControl IO m) => (a -> m b) -> t a -> m (t b)
newtype Concurrently (b :: * -> *) m a
Concurrently :: m a -> Concurrently m a
runConcurrently :: Concurrently m a -> m a
instance (b ~ IO, MonadBaseControl b m) => Alternative (Concurrently b m)
instance (b ~ IO, MonadBaseControl b m) => Applicative (Concurrently b m)
instance (b ~ IO, Functor m) => Functor (Concurrently b m)
