As an aside, you just (sort of) implented the IO monad.<p>The simplest explanation of the IO monad is that your Haskell application outputs a recipe or &quot;execution plan&quot;. This output is side effect free and pure. The runtime then executes your plan, producing those side effects.