iteratee countBytes, modifier which counts 'bytes'

Alex Lang lang at
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?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: countBytes.patch
Type: text/x-patch
Size: 12859 bytes
Desc: not available
URL: <>

More information about the Iteratee mailing list