|
|
|
|
|
by emih
88 days ago
|
|
That's a very good point, I never thought really about how this relates to the execution model & graph reduction and such. Do you have an example of a function where this can make a difference? I might add something to the article about it. It's also a question of whether this is exclusive to a curried definition or if such an optimization may also apply to partial application with a special operator like in the article. I think it could, but the compiler might need to do some extra work? |
|
foldr f z = go
when called with (+) and 0 can be inlined togo xs = case xs of
which doesn't have to create a closure to pass around the function and zero value, and can subsequently inline (+), etc.