How do SOLID principles apply to functional programming?

Answer

SOLID originated in OOP context but the underlying ideas translate to functional programming (FP). SRP maps to small, focused functions that do one thing. OCP maps to higher-order functions and function composition — extend behavior by composing functions, not modifying existing ones. LSP maps to the concept of parametric polymorphism — a function working on type A should work correctly for any subtype. ISP maps to narrowly typed function signatures — accept only the data fields a function actually uses. DIP maps to passing functions (behaviors) as parameters (higher-order functions) instead of hardcoding algorithms. In FP, immutability and pure functions naturally enforce many SOLID goals by design, making some violations structurally impossible.