Stream fusion (or deforestation, in general) is useful in languages that encourage function composition. For that, functions must receive and return a value that can be composed together. In my experience, languages in the style C or C++ encourage functions that modify the argument in place (caller supplies their own buffer, for example), which bypasses the problem of creating intermediate copies of the final result.
Just made me think. Linear types coming into Haskell should allow this sort of thing to be done in like in C++, avoiding the problem of worrying about fusion and compiler rewrite rules.
4 comments
[ 4.8 ms ] story [ 16.8 ms ] threadStream fusion (or deforestation, in general) is useful in languages that encourage function composition. For that, functions must receive and return a value that can be composed together. In my experience, languages in the style C or C++ encourage functions that modify the argument in place (caller supplies their own buffer, for example), which bypasses the problem of creating intermediate copies of the final result.