
On Jun 8, 2011, at 11:17 PM, Gregory Guthrie wrote:
I rather had the feeling expressed by Robert Harper: " Once you're in the IO monad, you're stuck there forever, and are reduced to Algol-style imperative programming." (http://existentialtype.wordpress.com/2011/05/01/of-course-ml-has-monads/ )
If Algol is as elegant and expressive as IO in Haskell, I'd hardly consider that a problem. In fact, I would seriously consider learning Algol. There seems to be a lot of IO-hate floating around, but in my opinion it is largely undeserved. Even if every function in Haskell had to use IO, Haskell would still be a vastly more expressive language than most. It would essentially be a lazy dialect of ML with different syntax and without parameterized modules (and, in GHC, with a lot of awesome type system extensions). IO has pretty much the same expressiveness as ML. It has higher-order functions, closures, etc. You can build higher level abstractions on top of it, and people do - there are some pretty awesome libraries out there that are nothing more than "glorified" IO. The CHP library, for example, builds a very powerful and very un-IO-like abstraction on top of IO. IO is not such a bad place to be stuck, all things considered. I think there is a tendency to look at IO as bad because pure code is so much better. But it's important to keep things in perspective - the existence of something better doesn't make something bad. IO is still better than the best of most other languages. -- James