3 ms·
If you wanted their side effects, they would have to be in a context that tabulates their side effects - i.e., a monad. Operations in a monadic context (I/O, mu
by GeneralMayhem 12y ago
If you wanted their side effects, they would have to be in a context that tabulates their side effects - i.e., a monad. Operations in a monadic context (I/O, mutating state, etc.) are generally not commutable - or if they are, the circumstances under which they are can be expressed in the definition of the monad. On the other hand, part of the point of Haskell is that any side effects must be made explicit, so if all you've got is a function, you can be guaranteed that there are no side effects.