Theory

Combinators are functions that manipulate functions.

combinatortypepurpose
(.)composition
flipswap arguments
($)low‑precedence application
ididentity

Eta-conversion

  • Expansion:
  • Contraction: (when not free in )

Implementation

-- Point‑free rewrite
sumOfSquares = sum . map (^2)
 
-- Re‑order for foldl
foldl (flip (:)) [] xs   ==   reverse xs