progress-reporting-1.1.0: Functionality for reporting function progress.

Copyright(c) 2016 Chordify B.V. Groningen
LicenseLGPL-3
Maintainerhaskelldevelopers@chordify.net
Stabilitystable
Portabilitynon-portable
Safe HaskellSafe
LanguageHaskell2010

Control.Monad.Progress

Contents

Description

Summary: Functionality for reporting function progress.

Synopsis

Data types

data WithProgress m a b Source #

Instances

Category * (WithProgress m) Source # 

Methods

id :: cat a a #

(.) :: cat b c -> cat a b -> cat a c #

Exported functions

runWithProgress :: Monad m => WithProgress m a b -> (Double -> m ()) -> a -> m b Source #

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.

runWithPercentage :: MonadIO m => WithProgress m a b -> (Int -> m ()) -> a -> m b Source #

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.

withProgressFromList :: forall a b m. (Monad m, NFData b) => (a -> [b]) -> WithProgress m a [b] Source #

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.

withProgressM :: ((Double -> m ()) -> a -> m b) -> WithProgress m a b Source #

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.

setWeight :: Double -> WithProgress m a b -> WithProgress m a b Source #

Set the weight of a pipeline element (default is 1).

printComponentTime :: MonadIO m => WithProgress m a b -> a -> m b Source #

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.

Combining progress

(>>>) :: Category k cat => cat a b -> cat b c -> cat a c infixr 1 #

Left-to-right composition