I think it needs to be thought of as part of an overarching design - again, see Gary Bernhardt. A pure functional core that can be unit tested against, where the tricky logic happens. And a shell where you deal with dirty but dumb things like thread pools, logging, error handling, non-pure libraries etc. And then just be very diligent to separate concerns, i.e. don't put too many smart things into the shell.