Regarding `avoid side-effects`, the amount of side-effects that are required for a typical real problem solving code base is quite reasonably measurable. For example, the number of network calls, DB calls, FileSystem read/writes are are measurable. Have you been able to reduce the `side-effects` significantly or have just become more aware of it?
When we started using ExpressJS (coming away from Java), there was a tremendous change. As soon as you begin to code in Javascript (say from Java/Ruby/Python world), async hits you. There is no escaping it. And the programmer faces a tax (every time when implementing async/await or generators), his/her awareness about side-effects (deliberately generalizing IO as side-effects) and they tend to be more careful with it.
Avoiding side effects sounds like something someone new to Haskell would say. Haskell in no way avoids side effects. Actually I'd say it embraces them by introducing special semantics just for them! What it does do is encourage you to move side effects to the "edge" of your code base and produce a more clean separation between pure & non-pure code. This is incredibly valuable for testing and overall correctness.
Right, and this is what I actually meant. It's not that side-effects disappear, but rather that I try not to litter my code with them. I avoid them in the sense that I don't embrace a side-effect-heavy style of coding, as I did with my imperative code prior to learning Haskell.
Perhaps I could have worded that better. Sorry for the confusion.
> Have you been able to reduce the `side-effects` significantly or have just become more aware of it?
Yes, sorry, I think I didn't explain myself very well.
Prior to learning Haskell and embracing The Way, my code was fairly covered in side-effects. I was a relatively junior programmer at this point (many years of experience because I started young, but few years of real education). Side-effects were just, you know, a thing that happened because they were "the easy way".
After learning Haskell, I became much more conscious of side-effects. I realized that a lot of things I used to do could be done without side-effects, mostly by writing better functions and thinking more deliberately about how to eschew the side-effects.
That said, it's not like they're gone. It's just that I'm much more careful about them. I "avoid" them in that I do my best not to include them, but if there's a genuine use for them then that's fine. However, I have taken to naming my functions better to reflect their side-effecting nature, and I try to move the side-effecting functions to places that make more logical sense (instead of just wherever).
When we started using ExpressJS (coming away from Java), there was a tremendous change. As soon as you begin to code in Javascript (say from Java/Ruby/Python world), async hits you. There is no escaping it. And the programmer faces a tax (every time when implementing async/await or generators), his/her awareness about side-effects (deliberately generalizing IO as side-effects) and they tend to be more careful with it.