Theory
Combinators are functions that manipulate functions.
| combinator | type | purpose |
|---|---|---|
(.) | composition | |
flip | swap arguments | |
($) | low‑precedence application | |
id | identity |
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