[Haskell-cafe] stream/bytestring questions

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sun Feb 17 19:36:29 EST 2008

On Feb 17, 2008, at 19:23 , Chad Scherrer wrote:

> On Feb 17, 2008 4:13 PM, Brandon S. Allbery KF8NH  
> <allbery at ece.cmu.edu> wrote:
>> Have you looked at the stream-fusion package on Hackage?
>> http://hackage.haskell.org/cgi-bin/hackage-scripts/package/stream-
>> fusion-0.1.1
> Yeah, I've seen this. It's nice that this is separated, but a little
> unsatisfying that the bytestring library reimplements it rather than
> just requiring it as a dependency. This, and the fact that bytestrings
> are way fast, while the stream-fusion stuff is sometimes slower than
> just using lists, make me think that either (1) there's sometimes an
> advantage in programming directly to streams, or (2) maybe more of the
> stream functions need to be exposed in the API. Or maybe there's
> another reason... that's part of my question.

You should be able to find discussion of this here if you search for  
"stream fusion".  The short version, IIRC, is that (a) this is still  
an area of active research, with the above lagging behind the current  
work which is usually in current bytestrings; (b) the spinoff library  
at times conflicts badly with the existing ghc RULEs for lists, and I  
think some changes to the way ghc applies RULEs are going to happen  
at some point in order to ameliorate this.  (ghc's current handling  
of RULEs, inlining, and build/foldr etc. is a bit ad hoc and needs to  
be given structure so that it is possible to accurately control when  
and how they are applied.  This also has been discussed, either here  
or on haskell at .)

Don Stewart, Duncan Coutts (streams), and Simon Peyton-Jones (ghc)  
should be able to give details on this stuff, and hopefully one or  
more of them will jump in to correct any misrecollections or errors  
I've made.

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

More information about the Haskell-Cafe mailing list