iteratee countBytes, modifier which counts 'bytes'

Alex Lang lang at tsurucapital.com
Thu Jan 5 10:03:05 GMT 2012


Here is a patch for a function

countBytes :: forall m s a el. (Monad m, LL.ListLike s el, Nullable s)
=> I.Iteratee s m a -> I.Iteratee s m (a, Int64)

which keeps track of the number of 'bytes' (in fact not necessarily
bytes) consumed by an iteratee. It was inspired by countBytes in
snap-core[0], and Conrad Parker has had some use for it. I've also
included a quickcheck test called prop_countBytes. Perhaps something
like countUsage or trackUsage is a better name?

[0] http://hackage.haskell.org/packages/archive/snap-core/0.6.0.1/doc/html/src/Snap-Iteratee.html#countBytes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: countBytes.patch
Type: text/x-patch
Size: 12859 bytes
Desc: not available
URL: <http://projects.haskell.org/pipermail/iteratee/attachments/20120105/9864e039/attachment.bin>


More information about the Iteratee mailing list