Computerworld chats to Simon Peyton-Jones about the development of Haskell. Peyton-Jones speaks in depth about his desire to ‘do one thing well’,
as well as interest in lazy functional programming languages and their place in a world with rapidly increasing multi-core CPUs and clusters.
This is such a fantastic series of articles — I wonder whether they’ll be bundled in a book at one time.
The book will be extremely thick if that is the case. Not to mention the amount of advertisements they would add (haha, stupid computer world).
Anyway, you should be talking about Haskell. It nearly gave me a mind-implosion the first time I saw it. The idea of clean calls is so captivating I couldn’t stop reading it.
However, by simply sticking to purity they have made the system really difficult to comprehend at one go. It is no way similar to languages where you can work with subsets, like just a basic part of C. You really will have to expend some effort into understanding the entire idea before working with the language.
On the other hand, that makes the users of the language think of the problem on a much higher level than others. The example in the interview is exceptionally striking as it practically defined a physics-level pure function that is time independent — just input any value of time and it will work. It is just as elegant as how relativity unified time and space. If iteration is natural, recursion is divine, then this will earn you the direct one-way ticket to heaven!
Not to mention that, seriously, we need programmers to think at a higher level. The mass of programmers out there programming drivers seem to have trouble with practically everything other than issuing pointers. They seem to assume infinite memory space and processing speed… Scary! Putting more effort into programming would do everyone of us much good.
Very nice interview. I got to get into Haskell some of these days. Does anyone knows a good book that goes far enough to be useful for practical system building? I’d like to do some real work under the functional paradigm.
I would recommend Real World Haskell, a nice and practical tutorial (you can read it free online if you wish):
http://book.realworldhaskell.org/
Thanks a lot. This seems to be a very nice book. As I dislike reading on screen, I’ll probably buy a copy – along with some other book on lambda calculus — theory is cool .
It sucks because programming is 99% about “side effects” than mathematical formulas.
Please note the use of quotes for ‘side effects’. They are called ‘side effects’, although they are the most interesting part of programming. It’s the part that things happen inside a computer that change the world.
Haskell makes it really difficult to write useful code (where useful means ‘with side effects’).
They may show you how to create ‘infinite’ number sequences and process them.
Cool. Ask them to make a Model-View-Controller application in Haskell, where the model is a tree of nodes. Trivial in imperative languages, hard as hell in Haskell: you have to use the Zipper monad, mix the useful code with visitation to the tree code, because the only way to modify tree node links in Haskell is via local parameters…
Actually, you’re dead wrong. Model-view-controller is not only easy in Haskell, much of the design is enforced! Typically, the model will consist primarily of pure functions, in your case, some pure functions manipulating a tree of nodes. The view and controller, on the other hand, will (at least in part), be in the IO monad, since they’re required to do input and output. This gives you a lot of the required restrictions on how the model communicates with the view and controller for free.
Of course, there are details like how you’re going to store the tree. You could possibly use a zipper (not necessarily a monad), if that suits your application, but also quite possibly a straightforward tree data structure will do. If the manipulations you’re doing are very graph theoretic in nature, with lots of rewiring of edges, representing the tree as, say, a Data.Map from vertices to sets of vertices might work better. (More or less equivalent to using sets of pointers to build a mutable tree in a lower-level language.)
If you’d like help with a specific program, or more details about how this works, come and talk to me on IRC. I’m Cale in #haskell on freenode.irc.net. If I’m not there, someone else will be happy to help you, I’m sure.
Haskell is not a particularly difficult language to use, but it requires a little bit of mental rewiring in terms of the way you think about programming, which makes the learning curve steeper for those who are already intimately familiar with the imperative programming model.