-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Functionality for reporting function progress.
--
-- This module provides a set of functions for writing functions that
-- report their own progress in a monadic context, which can be evaluated
-- to get progress reports while time-consuming functions are running.
@package progress-reporting
@version 1.0.0
-- | Summary: Functionality for reporting function progress.
module Control.Monad.Progress
data WithProgress m a b
-- | Run a computation with progress reporting. The given function will be
-- called each time the progress is updated, and the number is always
-- between 0 and 1.
runWithProgress :: Monad m => WithProgress m a b -> (Double -> m ()) -> a -> m b
-- | Run a computation with progress reporting. The given function will be
-- called at most once per percentage, which is a number between 0 and
-- 100.
runWithPercentage :: MonadIO m => WithProgress m a b -> (Int -> m ()) -> a -> m b
-- | From a function a -> [b], construct a function that can
-- reports its progress. Important remark: The resulting list must
-- not be lazily constructed, it should be immediately possible to
-- compute the length of this list in order for
-- withProgressFromList to work correctly.
withProgressFromList :: forall a b m. (Monad m, NFData b) => (a -> [b]) -> WithProgress m a [b]
-- | Construct a function that reports its own progress. This function must
-- call the given function to report progress as a fraction between 0 and
-- 1.
withProgressM :: ((Double -> m ()) -> a -> m b) -> WithProgress m a b
-- | Set the weight of a pipeline element (default is 1).
setWeight :: Double -> WithProgress m a b -> WithProgress m a b
-- | Run the computation with progress reporting, and measure the time of
-- each component and print that to the screen. This function can be used
-- to decide what the weight of each component should be.
printComponentTime :: MonadIO m => WithProgress m a b -> a -> m b
-- | Left-to-right composition
(>>>) :: Category k cat => cat a b -> cat b c -> cat a c
infixr 1 >>>
instance Control.Category.Category (Control.Monad.Progress.WithProgress m)