3 ms·
Yes true. Running a program with no side effects is a no-op. All side effect free programs are identical, and do nothing. This is one of the most common misc
by Sssnake 13y ago
Yes true. Running a program with no side effects is a no-op. All side effect free programs are identical, and do nothing. This is one of the most common misconceptions people afraid to learn haskell bring up, because people keep saying "functional programming is having no side effects".
- pera 13y agoIt's funny: "not having side effects" was the main reason for me to start learning Haskell just because that idea didn't make much sense hah
- nbouscal 13y agoSo you're saying that a library that has no side effects but performs a complicated data transformation "doesn't do anything"?
- Sssnake 13y agoA library is not a program.
- nbouscal 13y agoYour claim was "Without side effects you couldn't do anything." I was rebutting that claim. Again, unless you want to claim that libraries "don't do anything." The more specific claim that you need side effects for a program to do anything is also false. You can prove mathematical theorems with programs that have no side effects. Of course now you'll say that that only works because of the compiler, which does have side effects, but that's really just moving the target so you can be "right" (as you did with this post). Even if theorem proving isn't good enough, since the entire purpose for having the term "side effects" is to be able to usefully discuss referential transparency, the other poster who noted that IO can be an effect and not necessarily a side effect was correct. If IO is isolated, it is not a side effect, it is just an effect. A good example of this is the execution of the main action in a Haskell program.
- Sssnake 13y agoYou are not rebutting that claim, you are being obtuse. >You can prove mathematical theorems with programs that have no side effects No, of course you can not. How do you see the result? That requires a side effect of some kind. >A good example of this is the execution of the main action in a Haskell program. That is a terrible example, as executing main precisely is a side effect.
- nbouscal 13y ago> No, of course you can not. How do you see the result? That requires a side effect of some kind. The result is whether or not the program type-checks. Your original claim was, again, that "without side effects you can't do anything". So, again, unless you are claiming that functions and libraries "don't do anything", your original claim was incorrect. Your new claim, that programs must have side effects to do anything, is still wrong but more debatable. You can call me obtuse if you want to, or you can learn how to communicate clearly and say what you actually mean. Doesn't much matter to me either way.
- Sssnake 13y ago>The result is whether or not the program type-checks. Ok, you are very confused. Type checking has nothing to do with program execution. Type checking is done at compile time. Any program with no side effects, the compile can safely optimize into nothing, since it does nothing. The compiler does the type checking, not the program. >Your new claim, that programs must have side effects to do anything, is still wrong but more debatable. It is the claim I made and you replied to. If you want to be pedantic and obtuse you can't expect people to not call you out on it.
- nbouscal 13y agoSeriously? I'm directly quoting you in a post that is still visible, and you're denying it? Again, the quote that I originally replied to: "Without side effects you couldn't do anything." > Ok, you are very confused. You are both very arrogant and wrong. Not a pretty combination. Thank you oh so much for telling me that type checking is done at compile time, as though there were the slightest possibility I didn't know that given what I've been saying. If you took some time to learn how to have a conversation on the internet without being an asshole, you might actually learn something. Until then, I'll stop wasting my time trying to have a discussion with you. Cheers.