I have only worked with Haskell on a personal basis, trying to understand if purity has any actual advantages. I have yet to be persuaded about the need to have code be pure. I never had any issue reasoning about impure code, and I do not find that the impure style has actually benefited me in any way. My logic bugs still continue to appear in pure code.
What I really find annoying is when I have to update state. I always have to write tones of functions in order to re-synthesize the data after the smallest change, and the deeper the data model tree is the more functions are needed.
Did I ever have any benefit from using the IO monad or the state monad? I don't know..it seems to be the number of bugs between my non-IO code and my IO code is roughly the same.
Perhaps it shines on a collaborative level...I don't know, I never had the chance of writing Haskell code with other people.
Code purity isn't just for you, it's also for the compiler to be able to make assumptions about the code in order to apply optimizations that would not otherwise be possible. For example, if the compiler "knows" that a certain branch won't be used, it doesn't have to evaluate it. This is part of the reason why Haskell can reach near-C performance and why its recursion is particularly performative.
What I really find annoying is when I have to update state. I always have to write tones of functions in order to re-synthesize the data after the smallest change, and the deeper the data model tree is the more functions are needed.
Did I ever have any benefit from using the IO monad or the state monad? I don't know..it seems to be the number of bugs between my non-IO code and my IO code is roughly the same.
Perhaps it shines on a collaborative level...I don't know, I never had the chance of writing Haskell code with other people.