You will probably like this thread: How are clojurians handling control flow on their projects? - #9 by didibus
I also recommend this paper: https://www.cse.chalmers.se/~rjmh/Papers/whyfp.pdf
In general, there are two approaches:
- Keep the side-effects/imperative at the top layer
- Inject the side-effects/imperative bits, so you can inject pure alternative when needed (like in tests)