Interfacing Pure Functions with Our Impure World
Introducing the functional core–imperative shell architecture Here Comes the Challenge Functional programming is about utilizing pure functions. By putting the business logic into these functions, ...

Source: DEV Community
Introducing the functional core–imperative shell architecture Here Comes the Challenge Functional programming is about utilizing pure functions. By putting the business logic into these functions, which by definition are free of side effects, many things become easier (e.g., testing as described in [[why-functional-programming-caught-me]]). But every real application must still perform effectful operations such as IO, updating state, or reacting in a time‑based manner — otherwise the application would be useless. So you might have noticed the elephant in the room: how can effect‑free functions ultimately cause the effects an application must perform? Addressing the Elephant The high‑level answer is surprisingly simple: pure functions let someone else perform side effects for them. Therefore, they return data describing what should happen, and their caller interprets them and performs the effects. So, effect‑related behavior still happens—it’s just moved to the call site. For example, a