We present a unifying solution to the problem of fusion of functions, where both the producer function and the consumer function have one accumulating parameter. The key idea in this development is to formulate the producer function as a function which computes over a monoid of data contexts. Upon this formulation, we develop a fusion method called algebraic fusion based on the elementary theory of universal algebra and monoids. The producer function is fused with a monoid homomorphism that is derived from the definition of the consumer function, and is turned into a higher-order function f that computes over the monoid of endofunctions. We then introduce a general concept called improvement, in order to reduce the cost of computing over the monoid of endofunctions (i.e., function closures). An improvement of the function f via a monoid homomorphism h is a function g that satisfies f = h g. This provides a principled way of finding a first-order function representing a solution to th...