Tagged Questions
31
votes
10answers
5k views
Why are side-effects considered evil in functional programming?
I feel that side effects are a natural phenomenon. But it is something like taboo in functional languages. What are the reasons?
Edit: My question is specific to functional programming style. Not all ...
20
votes
3answers
2k views
Different ways to see a monad
While learning Haskell I have faced a lot of tutorials trying to explain what are monads and why monads are important in Haskell. Each of them used analogies so it would be easier to catch the ...
14
votes
4answers
2k views
Asynchronous Programming in Functional Languages
I'm mostly a C/C++ programmer, which means that the majority of my experience is with procedural and object-oriented paradigms. However, as many C++ programmers are aware, C++ has shifted in emphasis ...
9
votes
2answers
396 views
Where do we put “asking the world” code when we separate computation from side effects?
According to Command-Query Separation principle, as well as Thinking in Data and DDD with Clojure presentations one should separate side effects (modifying the world) from computations and decisions, ...
6
votes
3answers
715 views
How is referential transparency enforced?
In FP languages, calling a function with the same parameters over and over again returns the same result over and over again (i.e. referential transparency).
But a function like this (pseudo-code):
...
6
votes
3answers
307 views
Side Effects Breaking Referential Transparency
Functional Programming in Scala explains a side effect’s impact on breaking referential transparency:
side effect, which implies some violation of referential transparency.
I’ve read part of ...
2
votes
2answers
247 views
Can referentially transparent functions have side effects?
I read everywhere that referential transparency and side-effects are mutually exclusive for all functions, however, what about the case in which a function changes some state that has no effect on its ...