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


-- | A Haskell library to provide companion threads.
--   
--   Please see the README on GitHub at
--   <a>https://github.com/commercialhaskell/companion#readme</a>
@package companion
@version 0.1.0


-- | Companion threads, such as for printing messages saying we're still
--   busy.
module Control.Concurrent.Companion

-- | Keep running the <a>Companion</a> action until either the inner action
--   completes or calls the <a>StopCompanion</a> action. This can be used
--   to give the user status information while running a long running
--   operations.
withCompanion :: forall m a. MonadUnliftIO m => Companion m -> (StopCompanion m -> m a) -> m a

-- | When a delay was interrupted because we're told to stop, perform this
--   action.
onCompanionDone :: MonadUnliftIO m => m () -> m () -> m ()

-- | A companion thread which can perform arbitrary actions as well as
--   delay.
type Companion m = Delay -> m ()

-- | Delay the given number of microseconds. If <a>StopCompanion</a> is
--   triggered before the timer completes, a <a>CompanionDone</a> exception
--   will be thrown (which is caught internally by <a>withCompanion</a>).
type Delay = forall mio. MonadIO mio => Int -> mio ()

-- | Tell the <a>Companion</a> to stop. The next time <a>Delay</a> is
--   called, or if a <a>Delay</a> is currently blocking, the
--   <a>Companion</a> thread will exit with a <a>CompanionDone</a>
--   exception.
type StopCompanion m = m ()
instance GHC.Show.Show Control.Concurrent.Companion.CompanionDone
instance GHC.Exception.Type.Exception Control.Concurrent.Companion.CompanionDone
