[Haskell-cafe] 'Progress bar' enumeratee

Ertugrul Soeylemez es at ertes.de
Wed Apr 6 22:14:47 CEST 2011


"David Hotham" <david.hotham at blueyonder.co.uk> wrote:

> The desired behaviour (certainly my desired behaviour, but I think
> also the most useful behaviour generally) is that the enumeratee
> passes n bytes to its iteratee, prints a dot, and repeats.
>
> Given that, printing the dots all in one bunch after passing bytes to
> the iteratee isn't any improvement over printing the dots all in one
> bunch before passing them to the iteratee.
>
> I think that mostly I want it the way that I want it because that's
> the bit that I struggled most over and I'm now reluctant to give it
> up!  However this might actually make a useful difference to behaviour
> in the case of an iteratee that did very expensive processing, or that
> itself performed IO.  In such cases, my behaviour could be expected to
> give a more accurate indication of how far through processing we'd
> actually got.

If you're talking about my code, you must have misunderstood something.
It does not print the dots all in one bunch, but prints them as input is
requested from the enumerator.  The last version I posted prints the
dots after the iteratee has consumed the input.  That difference is
noticable, when your iteratee does complex computations before it goes
back to the Continue state.


Greets,
Ertugrul


-- 
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/





More information about the Haskell-Cafe mailing list