Pure means that functions are not allowed to have side effects. More formally, a pure function can only use its inputs (parameters) to generate its output. Therefore, a pure function can't modify a global variable, print to the screen etc. because those are all side effects (more on this later). The benefit of this is threefold:
* Testing is much safer and generally easier. You just have to test the various inputs and edge cases and you can pretty much guarantee the function is 100% correct. You can't get this guarantee in impure languages.
* Inherently concurrent. Since functions don't modify any global state, you're free to make this as concurrent as you want without worrying about "thread safety" and all that.
* Increased modularity. Pure functions are highly portable, since they don't modify state they can be used for any library if needed, really. In an impure language, you often have to modify functions for use in a more general sense as a library.
Of course, the real world has side effects. Almost every program we run is a side effect, since we're giving it input from the world and it uses that to print to a screen. So how can a program be pure at all???
Without going into too much detail, there are ways in Haskell to isolate impurity to a small part of the code which is clearly marked as impure. This impure code is responsible for say, reading a string from the user input. This string can then be used to make function calls to pure functions.
So the way you do things is to put all your business logic and such in pure functions, then the impure functions just deal with shuttling values to and from the real world. You can test pure functions with theorem checkers and you test impure functions with unit tests and integration tests.
Haskell has a steep learning curve since it has so many concepts which still simply haven't made it into more industry-standard languages. This is getting better with language such as Scala becoming more mainstream.
I really love Haskell and even if I don't use it on my day-to-day, it is great to hack out a Haskell program every once in awhile.
Hope this helps!
- Mitchell