Hacker News new | comments | show | ask | jobs | submit login

I remember a quote by SPJ but am unable to find a reference to it right now. It goes something like: "a program without I/O is merely heating space."

Pure Haskell programs have no side effects, where "side effect" is defined as an effect that occurs implicitly outside of the function's signature. They can definitely have non-side effects; they just have to be explicit about it (the same with IO). For some reason, "side effect" have come to mean effects in general...

Parent's observation probably relates to the fact that doing IO in Haskell is "harder" than say in Python. There is some truth to that.




I think you are missing the parents point. Since everything is lazy in Haskell, a program without IO will literally do nothing. It will not evaluate a single line of code.

To expound, Haskell pure functions do not run code. They produce code to be run at a future date. The infamous IO monad is essentially a wrapper around this code which contains information on when the runtime is supposed to actually execute the code. The execution is always dependent on IO.

So, as the parent said, a Haskell program without IO is literally nothing.


Yes, but grandparent wasn't complaining about the inability of doing IO in Haskell:

> The choice of a pure functional language like Haskell to do lots of IO seems like a strange choice given that Haskell makes side effects like IO more difficult than other languages.

The argument was that doing IO in Haskell was difficult. So if you take programming as pure code intertwined with IO, the benefits of using Haskell would go down as the fraction of IO increased if the premise that "doing IO was more difficult in Haskell" was true.

So parent said something true, but I'm not sure how it relates to grandparent's comment.





Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: