|
|
|
|
|
by jeremyjh
4141 days ago
|
|
> The choice of a pure functional language like Haskell to do lots of IO seems like a strange choice Can you tell me what a program which does no I/O actually does? I can tell you what it does in Haskell: nothing. Without IO, there would be no reason for a computation to ever run in Haskell (or in any other language, but Haskell will actually NOT run it). Every Haskell program does I/O. I know when I first heard about functional programming and Haskell in particular, that ideas like purity, no side-effects and immutability seemed absurd. "But, but - the programs I write always do I/O and manage state!?" So do Haskell programs, they simply do it differently. If a program had no side effects it would have no purpose. Please do not assume that the tool used by an entire community is not well suited to building programs that have a purpose. |
|
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.