-- 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 async package lifted
--   to any instance of MonadBase or MonadBaseControl.
@package lifted-async
@version 0.10.2.7

-- | This is a wrapped version of Control.Concurrent.Async with
--   types generalized from IO to all monads in either
--   MonadBase or MonadBaseControl.
--   
--   All the functions restore the monadic effects in the forked
--   computation unless specified otherwise.
--   
--   If your monad stack satisfies StM m a ~ a (e.g. the
--   reader monad), consider using
--   Control.Concurrent.Async.Lifted.Safe module, which prevents
--   you from messing up monadic effects.
module Control.Concurrent.Async.Lifted

-- | An asynchronous action spawned by async or withAsync.
--   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. wait).
data Async a

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

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

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

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

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

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

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

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

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

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

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

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

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

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

-- | Generalized version of uninterruptibleCancel.
uninterruptibleCancel :: MonadBase IO m => Async a -> m ()

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

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

-- | The exception thrown by cancel to terminate a thread.
data AsyncCancelled
AsyncCancelled :: AsyncCancelled

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

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

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

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

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

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

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

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

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

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

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

-- | Generalized version of waitEither_.
--   
--   NOTE: This function discards the monadic effects besides IO in the
--   forked computation.
waitEither_ :: MonadBase IO m => Async a -> Async b -> m ()

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

-- | A version of waitAny that can be used inside an STM
--   transaction.
waitAnySTM :: [Async a] -> STM (Async a, a)

-- | A version of waitAnyCatch that can be used inside an STM
--   transaction.
waitAnyCatchSTM :: [Async a] -> STM (Async a, Either SomeException a)

-- | A version of waitEither that can be used inside an STM
--   transaction.
waitEitherSTM :: Async a -> Async b -> STM (Either a b)

-- | A version of waitEitherCatch that can be used inside an STM
--   transaction.
waitEitherCatchSTM :: Async a -> Async b -> STM (Either (Either SomeException a) (Either SomeException b))

-- | A version of waitEither_ that can be used inside an STM
--   transaction.
waitEitherSTM_ :: Async a -> Async b -> STM ()

-- | A version of waitBoth that can be used inside an STM
--   transaction.
waitBothSTM :: Async a -> Async b -> STM (a, b)

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

-- | Generalized version of link2.
link2 :: MonadBase IO m => Async a -> Async b -> m ()
data ExceptionInLinkedThread
ExceptionInLinkedThread :: Async a -> SomeException -> ExceptionInLinkedThread

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

-- | Generalized version of race_.
--   
--   NOTE: This function discards the monadic effects besides IO in the
--   forked computation.
race_ :: MonadBaseControl IO m => m a -> m b -> m ()

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

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

-- | Generalized version of mapConcurrently.
mapConcurrently :: (Traversable t, MonadBaseControl IO m) => (a -> m b) -> t a -> m (t b)

-- | Generalized version of mapConcurrently_.
mapConcurrently_ :: (Foldable t, MonadBaseControl IO m) => (a -> m b) -> t a -> m ()

-- | Generalized version of forConcurrently.
forConcurrently :: (Traversable t, MonadBaseControl IO m) => t a -> (a -> m b) -> m (t b)

-- | Generalized version of forConcurrently_.
forConcurrently_ :: (Foldable t, MonadBaseControl IO m) => t a -> (a -> m b) -> m ()

-- | Generalized version of replicateConcurrently.
replicateConcurrently :: MonadBaseControl IO m => Int -> m a -> m [a]

-- | Generalized version of replicateConcurrently_.
replicateConcurrently_ :: MonadBaseControl IO m => Int -> m a -> m ()

-- | Generalized version of Concurrently.
--   
--   A value of type Concurrently m a is an IO-based
--   operation that can be composed with other Concurrently values,
--   using the Applicative and Alternative instances.
--   
--   Calling runConcurrently on a value of type
--   Concurrently m a will execute the IO-based lifted
--   operations it contains concurrently, before delivering the result of
--   type a.
--   
--   For example
--   
--   
--   (page1, page2, page3) <- runConcurrently $ (,,)
--     <$> Concurrently (getURL "url1")
--     <*> Concurrently (getURL "url2")
--     <*> Concurrently (getURL "url3")
--   
newtype Concurrently (m :: Type -> Type) a
Concurrently :: m a -> Concurrently (m :: Type -> Type) a
[runConcurrently] :: Concurrently (m :: Type -> Type) a -> m a

-- | Compare two Asyncs that may have different types by their
--   ThreadId.
compareAsyncs :: Async a -> Async b -> Ordering
instance Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO m => GHC.Internal.Base.Alternative (Control.Concurrent.Async.Lifted.Concurrently m)
instance Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO m => GHC.Internal.Base.Applicative (Control.Concurrent.Async.Lifted.Concurrently m)
instance GHC.Internal.Base.Functor m => GHC.Internal.Base.Functor (Control.Concurrent.Async.Lifted.Concurrently m)
instance (Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO m, GHC.Internal.Base.Semigroup a, GHC.Internal.Base.Monoid a) => GHC.Internal.Base.Monoid (Control.Concurrent.Async.Lifted.Concurrently m a)
instance (Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO m, GHC.Internal.Base.Semigroup a) => GHC.Internal.Base.Semigroup (Control.Concurrent.Async.Lifted.Concurrently m a)

-- | This is a safe variant of Control.Concurrent.Async.Lifted.
--   
--   This module assumes your monad stack to satisfy StM m a ~
--   a so you can't mess up monadic effects. If your monad stack is
--   stateful, use Control.Concurrent.Async.Lifted with special
--   care.
module Control.Concurrent.Async.Lifted.Safe

-- | An asynchronous action spawned by async or withAsync.
--   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. wait).
data Async a

-- | Most of the functions in this module have Forall
--   (Pure m) in their constraints, which means they require
--   the monad m satisfies StM m a ~ a for all
--   a.
class StM m a ~ a => Pure (m :: Type -> Type) a
class forall (a :: k). () => p a => Forall (p :: k -> Constraint)

-- | Generalized version of async.
async :: (MonadBaseControl IO m, Forall (Pure m)) => m a -> m (Async a)

-- | Generalized version of asyncBound.
asyncBound :: (MonadBaseControl IO m, Forall (Pure m)) => m a -> m (Async a)

-- | Generalized version of asyncOn.
asyncOn :: (MonadBaseControl IO m, Forall (Pure m)) => Int -> m a -> m (Async a)

-- | Generalized version of asyncWithUnmask.
asyncWithUnmask :: (MonadBaseControl IO m, Forall (Pure m)) => ((forall b. () => m b -> m b) -> m a) -> m (Async a)

-- | Generalized version of asyncOnWithUnmask.
asyncOnWithUnmask :: (MonadBaseControl IO m, Forall (Pure m)) => Int -> ((forall b. () => m b -> m b) -> m a) -> m (Async a)

-- | Generalized version of withAsync.
withAsync :: (MonadBaseControl IO m, Forall (Pure m)) => m a -> (Async a -> m b) -> m b

-- | Generalized version of withAsyncBound.
withAsyncBound :: (MonadBaseControl IO m, Forall (Pure m)) => m a -> (Async a -> m b) -> m b

-- | Generalized version of withAsyncOn.
withAsyncOn :: (MonadBaseControl IO m, Forall (Pure m)) => Int -> m a -> (Async a -> m b) -> m b

-- | Generalized version of withAsyncWithUnmask.
withAsyncWithUnmask :: (MonadBaseControl IO m, Forall (Pure m)) => ((forall c. () => m c -> m c) -> m a) -> (Async a -> m b) -> m b

-- | Generalized version of withAsyncOnWithUnmask.
withAsyncOnWithUnmask :: (MonadBaseControl IO m, Forall (Pure m)) => Int -> ((forall c. () => m c -> m c) -> m a) -> (Async a -> m b) -> m b

-- | Generalized version of wait.
wait :: (MonadBase IO m, Forall (Pure m)) => Async a -> m a

-- | Generalized version of poll.
poll :: (MonadBase IO m, Forall (Pure m)) => Async a -> m (Maybe (Either SomeException a))

-- | Generalized version of waitCatch.
waitCatch :: (MonadBase IO m, Forall (Pure m)) => Async a -> m (Either SomeException a)

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

-- | Generalized version of uninterruptibleCancel.
uninterruptibleCancel :: MonadBase IO m => Async a -> m ()

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

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

-- | The exception thrown by cancel to terminate a thread.
data AsyncCancelled
AsyncCancelled :: AsyncCancelled

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

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

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

-- | Generalized version of waitAny.
waitAny :: (MonadBase IO m, Forall (Pure m)) => [Async a] -> m (Async a, a)

-- | Generalized version of waitAnyCatch.
waitAnyCatch :: (MonadBase IO m, Forall (Pure m)) => [Async a] -> m (Async a, Either SomeException a)

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

-- | Generalized version of waitAnyCatchCancel.
waitAnyCatchCancel :: (MonadBase IO m, Forall (Pure m)) => [Async a] -> m (Async a, Either SomeException a)

-- | Generalized version of waitEither.
waitEither :: (MonadBase IO m, Forall (Pure m)) => Async a -> Async b -> m (Either a b)

-- | Generalized version of waitEitherCatch.
waitEitherCatch :: (MonadBase IO m, Forall (Pure m)) => Async a -> Async b -> m (Either (Either SomeException a) (Either SomeException b))

-- | Generalized version of waitEitherCancel.
waitEitherCancel :: (MonadBase IO m, Forall (Pure m)) => Async a -> Async b -> m (Either a b)

-- | Generalized version of waitEitherCatchCancel.
waitEitherCatchCancel :: (MonadBase IO m, Forall (Pure m)) => Async a -> Async b -> m (Either (Either SomeException a) (Either SomeException b))

-- | Generalized version of waitEither_
waitEither_ :: MonadBase IO m => Async a -> Async b -> m ()

-- | Generalized version of waitBoth.
waitBoth :: (MonadBase IO m, Forall (Pure m)) => Async a -> Async b -> m (a, b)

-- | A version of waitAny that can be used inside an STM
--   transaction.
waitAnySTM :: [Async a] -> STM (Async a, a)

-- | A version of waitAnyCatch that can be used inside an STM
--   transaction.
waitAnyCatchSTM :: [Async a] -> STM (Async a, Either SomeException a)

-- | A version of waitEither that can be used inside an STM
--   transaction.
waitEitherSTM :: Async a -> Async b -> STM (Either a b)

-- | A version of waitEitherCatch that can be used inside an STM
--   transaction.
waitEitherCatchSTM :: Async a -> Async b -> STM (Either (Either SomeException a) (Either SomeException b))

-- | A version of waitEither_ that can be used inside an STM
--   transaction.
waitEitherSTM_ :: Async a -> Async b -> STM ()

-- | A version of waitBoth that can be used inside an STM
--   transaction.
waitBothSTM :: Async a -> Async b -> STM (a, b)

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

-- | Generalized version of link2.
link2 :: MonadBase IO m => Async a -> Async b -> m ()
data ExceptionInLinkedThread
ExceptionInLinkedThread :: Async a -> SomeException -> ExceptionInLinkedThread

-- | Generalized version of race.
race :: (MonadBaseControl IO m, Forall (Pure m)) => m a -> m b -> m (Either a b)

-- | Generalized version of race_.
race_ :: (MonadBaseControl IO m, Forall (Pure m)) => m a -> m b -> m ()

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

-- | Generalized version of concurrently_.
concurrently_ :: (MonadBaseControl IO m, Forall (Pure m)) => m a -> m b -> m ()

-- | Generalized version of mapConcurrently.
mapConcurrently :: (Traversable t, MonadBaseControl IO m, Forall (Pure m)) => (a -> m b) -> t a -> m (t b)

-- | Generalized version of mapConcurrently_.
mapConcurrently_ :: (Foldable t, MonadBaseControl IO m, Forall (Pure m)) => (a -> m b) -> t a -> m ()

-- | Generalized version of forConcurrently.
forConcurrently :: (Traversable t, MonadBaseControl IO m, Forall (Pure m)) => t a -> (a -> m b) -> m (t b)

-- | Generalized version of forConcurrently_.
forConcurrently_ :: (Foldable t, MonadBaseControl IO m, Forall (Pure m)) => t a -> (a -> m b) -> m ()

-- | Generalized version of replicateConcurrently.
replicateConcurrently :: (MonadBaseControl IO m, Forall (Pure m)) => Int -> m a -> m [a]

-- | Generalized version of replicateConcurrently_.
replicateConcurrently_ :: (MonadBaseControl IO m, Forall (Pure m)) => Int -> m a -> m ()

-- | Generalized version of Concurrently.
--   
--   A value of type Concurrently m a is an IO-based
--   operation that can be composed with other Concurrently values,
--   using the Applicative and Alternative instances.
--   
--   Calling runConcurrently on a value of type
--   Concurrently m a will execute the IO-based lifted
--   operations it contains concurrently, before delivering the result of
--   type a.
--   
--   For example
--   
--   
--   (page1, page2, page3) <- runConcurrently $ (,,)
--     <$> Concurrently (getURL "url1")
--     <*> Concurrently (getURL "url2")
--     <*> Concurrently (getURL "url3")
--   
data Concurrently (m :: Type -> Type) a
[Concurrently] :: forall (m :: Type -> Type) a. Forall (Pure m) => m a -> Concurrently m a

-- | Compare two Asyncs that may have different types by their
--   ThreadId.
compareAsyncs :: Async a -> Async b -> Ordering
instance (Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO m, Data.Constraint.Forall.Forall (Control.Concurrent.Async.Lifted.Safe.Pure m)) => GHC.Internal.Base.Alternative (Control.Concurrent.Async.Lifted.Safe.Concurrently m)
instance (Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO m, Data.Constraint.Forall.Forall (Control.Concurrent.Async.Lifted.Safe.Pure m)) => GHC.Internal.Base.Applicative (Control.Concurrent.Async.Lifted.Safe.Concurrently m)
instance GHC.Internal.Base.Functor m => GHC.Internal.Base.Functor (Control.Concurrent.Async.Lifted.Safe.Concurrently m)
instance (Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO m, GHC.Internal.Base.Semigroup a, GHC.Internal.Base.Monoid a, Data.Constraint.Forall.Forall (Control.Concurrent.Async.Lifted.Safe.Pure m)) => GHC.Internal.Base.Monoid (Control.Concurrent.Async.Lifted.Safe.Concurrently m a)
instance (Control.Monad.Trans.Control.StM m a GHC.Types.~ a) => Control.Concurrent.Async.Lifted.Safe.Pure m a
instance (Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO m, GHC.Internal.Base.Semigroup a, Data.Constraint.Forall.Forall (Control.Concurrent.Async.Lifted.Safe.Pure m)) => GHC.Internal.Base.Semigroup (Control.Concurrent.Async.Lifted.Safe.Concurrently m a)
