Copyright | (c) 2016 Chordify B.V. Groningen |
---|---|
License | LGPL-3 |
Maintainer | haskelldevelopers@chordify.net |
Stability | stable |
Portability | non-portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Summary: Functionality for reporting function progress.
- data WithProgress m a b
- runWithProgress :: Monad m => WithProgress m a b -> (Double -> m ()) -> a -> m b
- runWithPercentage :: MonadIO m => WithProgress m a b -> (Int -> m ()) -> a -> m b
- withProgressFromList :: forall a b m. (Monad m, NFData b) => (a -> [b]) -> WithProgress m a [b]
- withProgressM :: ((Double -> m ()) -> a -> m b) -> WithProgress m a b
- setWeight :: Double -> WithProgress m a b -> WithProgress m a b
- printComponentTime :: MonadIO m => WithProgress m a b -> a -> m b
- (>>>) :: Category k cat => cat a b -> cat b c -> cat a c
Data types
data WithProgress m a b Source #
Category * (WithProgress m) Source # | |
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.