3 ms·
Interestingly, that's also a disadvantage since you cannot control effects (in the user-supplied code) if you're e.g. writing a library API with callbacks. On t
by lomnakkus 11y ago
Interestingly, that's also a disadvantage since you cannot control effects (in the user-supplied code) if you're e.g. writing a library API with callbacks. On the advantage side you have what you mentioned, namely "benign" effects -- but I've found that the "sprinkle a few debug printfs" use case is adequately handled with Debug.Trace... unless you're trying to debug a terminal application! :)
Logging is another popular example of a "benign" effect, but I personally don't think is: I mean, your logging library could be doing all kinds of weird things like shipping logs over TCP to a remote syslog daemon... and I don't want that to be hidden under the rug (using unsafePerformIO or similar) only to blow up later when the network happens to be down.
Anyway, having programmed in O'Caml for 3-4 years, I was won over to Haskell by the compiler-supported (side) effect tracking. I think it's also important to note the distinction between side effects and plain (desired) effects. Not enough people do this in these sorts of discussions.