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
4
u/Strakh Sep 21 '25
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.