ANN: progress-meter 1.0.0

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

ANN: progress-meter 1.0.0

Ertugrul Söylemez-3
Hi everybody,

I have just released a complete API rewrite of the `progress-meter`
package:

  * <https://hackage.haskell.org/package/progress-meter>
  * <https://github.com/esoeylemez/progress-meter>

With this package you can easily add live diagnostics to any
long-running application from a simple progress bar to full task
monitoring.  The `System.Progress` module contains a tutorial.
Features:

  * update progress from multiple threads,

  * non-progress diagnostics that just scroll by (e.g. logging),

  * breaking the state apart for individual threads, so they can update
    their relevant portion of the progress bar without interfering with
    each other ("zooming"),

  * smart throttling (no updates drawn when nothing is happening, and
    only ever drawn at a maximum rate).

Here is a very simple example:

    import Control.Concurrent
    import System.Progress

    main = withProgress_ "" id $ \pm -> do
        -- Set the progress bar:
        setMeter pm "Working..."

        -- Do some "work":
        threadDelay 3000000

        -- Print something while temporarily hiding the progress bar:
        putMsgLn pm "Some extra diagnostics that scrolls by"

        setMeter pm "Almost done..."
        threadDelay 1000000
        putMsgLn pm "Done."

The first argument of 'withProgress_' is the initial state and the
second is a renderer for the current state:

    render :: Int -> String
    render p = "Progress: " ++ show p ++ "%"

    withProgress_ 0 render $ \pm -> do
        threadDelay 1000000
        setMeter pm 10
        threadDelay 8900000
        setMeter pm 99
        -- The famous last percent:
        threadDelay 10000000
        putMsgLn pm "Done."

Progress-meter will do The Right Thing when you update the state or
produce log messages from multiple threads.


Happy holidays
ertes

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

signature.asc (497 bytes) Download Attachment