Re-read the article and I have a question on side-effects:
Looks like you are ignoring it or am I wrong?
Can you share a little how you think the impurity in your examples should be addressed?
I write code, front-end and back-end, and like deploying it on AWS. Software Developer for 20 years, and still love it. Amateur Powerlifter & Parkourist.
There are a few ways to handle them. In the article, I just use Promises.
The other way is to use Dependency Injection where things like fsModule, JSON.parse, and even request style things you make them part of the function parameters.
The other way is using the Effect functor. That's a lot of work in JavaScript without using libraries/languages that help you handle that (a la PureScript).
To learn more about DI and Effect: jrsinclair.com/articles/2018/how-t...
Thanks for the response!
I actually stumbled upon this post after asking you here and found it very helpful.
My conclusion after reading it and a few others was that side effects are not to be eliminated just to be minimized.
Where it is clear that there should be side effect I just leave it
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Re-read the article and I have a question on side-effects:
Looks like you are ignoring it or am I wrong?
Can you share a little how you think the impurity in your examples should be addressed?
There are a few ways to handle them. In the article, I just use Promises.
The other way is to use Dependency Injection where things like fsModule, JSON.parse, and even request style things you make them part of the function parameters.
The other way is using the Effect functor. That's a lot of work in JavaScript without using libraries/languages that help you handle that (a la PureScript).
To learn more about DI and Effect: jrsinclair.com/articles/2018/how-t...
Thanks for the response!
I actually stumbled upon this post after asking you here and found it very helpful.
My conclusion after reading it and a few others was that side effects are not to be eliminated just to be minimized.
Where it is clear that there should be side effect I just leave it