Published on

SOLID is FP!

Authors

SOLID is FP!

SOLID is FP!

S - Single Responsability Principle

A pure function is something with a single responsibility, turning its input into an output. What could be simpler

O - Open-Closed Principle

You don't need to modify the body of the functions when you can just modify what they return, or pass a function in

L - Liskov Substitution Principle

Every function is defined by it's type, if you take functions with the same input and output type, you can use them without being affected by the change.

I - Interface Segregation Principle

What are better client interfaces than a single function? just a function of course.

D - Dependency Inversion Principle

That's where FP shines, first-class functions are dependency inversion at the core. They're so pervasive in FP that you use without noticing all the boiler-plate code you didn't needed to write.