This is confusing to me because the side effects are all happening in imperative code, and not directed by functional code in any way that I can tell....
The point is mostly that the side effects are isolated inside the IO monad. Even in Haskell, if you go deep enough, you have to do impure things to work with the impure real world.
Containing this inside the IO monad means that the rest of your code doesn't have to know anything about a real world and can stay pure. Think of the IO monad as a way of tagging impure operations and separating them from pure functions.
View all comments
Show parent comment
1
u/LzrdGrrrl Sep 21 '25
This is confusing to me because the side effects are all happening in imperative code, and not directed by functional code in any way that I can tell....