Very interesting - thanks!
Gregory Collins g...@gregorycollins.net wrote in message
news:banlktikeh7aqfe2-jdq6docz+syw5mj...@mail.gmail.com...
My enumerator style may not be the best (I'm long-winded), but
personally when the stream types are the same on input and output I
often skip the
An error slipped into the version below. The line:
E.checkDone (E.continue . dotIn (count - len))
should read
E.checkDone (E.continue . dotIn (need - len))
David Hotham david.hot...@blueyonder.co.uk wrote in message
news:inhd6m$h2n$1...@dough.gmane.org...
Hello,
I've spent some time
David Hotham david.hot...@blueyonder.co.uk wrote:
I've spent some time over the last couple of days trying to write an
enumeratee that prints a . every n bytes (with obvious intended use
as a progress tracker). Seems like it oughtn't be hard, but it has
been a steep learning curve...
I
Thanks for the reply.
I did have a version along those lines at some point, but I felt it was
cheating rather to print the dots not at the correct point in the stream.
Perhaps I've over-complicated for the sake of the learning experience, but I
do like to have a version that passes on the
David Hotham david.hot...@blueyonder.co.uk wrote:
I did have a version along those lines at some point, but I felt it
was cheating rather to print the dots not at the correct point in the
stream.
Perhaps I've over-complicated for the sake of the learning experience,
but I do like to have a
As a side note, even though GHC seems to handle this properly, I would
force the value of 'i' before passing data to the continuation.
Otherwise a less smart compiler may eat memory. I believe, it can only
eat memory proportional to 'n', but nevertheless real constant space is
better:
seq i
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
My enumerator style may not be the best (I'm long-winded), but
personally when the stream types are the same on input and output I
often skip the Enumeratee stuff and just write an Enumerator wrapper.
To address your complaint here:
PS Implementations which involve EB.take count seem to me
David Hotham david.hot...@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