The documentation for scanl says “this function will fuse”. What exactly does fuse mean here? Is it bad?
The documentation for scanl says this function will fuse. What exactly does fuse mean
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.