3 ms·
A "pure" functional programming language has the problem you have identified and that is why haskel for a very long time was considered an academic language sin
by mhogomchungu 12y ago
A "pure" functional programming language has the problem you have identified and that is why haskel for a very long time was considered an academic language since it couldnt do anything useful as anything useful requires side effects like IO.
The above is how haskel was introduced when i took it in CS at Syracuse University.
The practicalities of haskel as a useful and practical language are realized through monads[1]. Use of monads to deal with side effects and impure world automatically make haskel "none pure".
With the existence of monads,the purity of the language is a matter of opinion or degrees since it largely based on "idiomatic" usage.
To say haskel is an impure language because of monads will be akin to say C# is an unsafe language because it allows pointer managements through the usage of "unsafe" keyword.
[1] http://en.wikipedia.org/wiki/Monad_%28functional_programming%29 http://en.wikipedia.org/wiki/Monad_%28functional_programming...
- galaxyLogic 12y agoGood explanation, thanks. I would take from it that "purity" is relative, just as "safeness" is. There are no safe languages, nor pure ones, just some that are more pure than others. I guess I would have grasped your point earlier if Haskell had a keyword "IMPURE", just like C# has the keyword "unsafe". Come to think of it, doesn't "pure" in the context of PLs mean much the same as "safe"?