Using Haskell as a digital circuit description language, we transform a ripple carry adder that requires O(n) time to add two n-bit words into an efficient carry lookahead adder that requires O(log n) time. The gain in speed relies on the use of parallel scan to calculate the propagation of carry bits efficiently. The main difficulty is that this scan cannot be parallelised directly since it is applied to a non-associative function. Several additional techniques are needed to circumvent the problem, including partial evaluation and symbolic function representation. The derivation given here provides a formal correctness proof, yet it also makes the solution more intuitive by bringing out explicitly each of the ideas underlying the carry lookahead adder.