The documentation for scanl says "this function will fuse". What exactly does fuse mean here? Is it bad?
http://www.haskell.org/haskellwiki/Short_cut_fusion
(and, for more information: http://www.haskell.org/haskellwiki/Correctness_of_short_cut_fusion)
If a function will fuse, that is a good thing. It means that a chain of functions can be merged into one function, which means less allocation, less stack, and more speed! Awesome!
Here's a trivial fusion: map f . map g
----> map (f . g)
.
As detailed above, there are many others that get applied by the RULES of the standard library as well.
It's kind of like coroutines - if you compose two functions they can execute on a fused stream instead of one being fully "evaluated" first then the second.
What is Haskell's Stream Fusion
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With