
On 10 November 2012 17:57, Johan Tibell
It better communicates intent. A e.g. lazy byte string can be used for two separate things:
* to model a stream of bytes, or * to avoid costs due to concatenating strings.
By using a strict byte string you make it clear that you're not trying to do the former (at some potential cost due to the latter). When you want to do the former it should be clear to the consumer that he/she better consume the string in an incremental manner as to preserve laziness and avoid space leaks (by forcing the whole string).
Good advice. And when you want to do the latter you should use a Builder[1] (or [2] if you're working with text). Bas [1] http://hackage.haskell.org/packages/archive/bytestring/0.10.2.0/doc/html/Dat... [2] http://hackage.haskell.org/packages/archive/text/0.11.2.3/doc/html/Data-Text...