The A-Z of Programming Languages: Haskell
- 19 September, 2008 17:11
- Comments 4
Simon Peyton-Jones
So would you have done anything different in the development of Haskell if you had the chance?
That’s a hard one. Of course we could have been cleverer, but even with retrospect, I’m not sure that I can see any major thing that I would have done differently.
And what’s the most interesting program you’ve seen written with Haskell?
That’s an interesting question. At first I was going to say GHC which is the compiler for Haskell. But I think the most interesting one, the one that really made me sit up and take notice, was Conal Elliot’s Functional Reactive Animation, called FRAN. He wrote this paper that burst upon the scene [at ICFP 1997].
What it allowed you to do is to describe graphical animations, so things like a bouncing ball. How do you make a ball bounce on the screen? One way to do it is to write a program that goes round a loop and every time it goes around the loop it figures out whether the ball should be one time step further on. It erases the old picture of the ball and draws a new picture. That’s the way most graphics are done one way or another, but it’s certainly hard to get right.
Another way to do it is, instead of repainting the screen, to say here is a value, and that value describes the position of the ball at any time. How can a value do that? Conal’s said ‘just give me a function, and the value I’ll produce will be a function from time to position. If I give you this function you can apply it at any old time and it will tell you where the ball is. So all this business of repainting the screen can be re-delegated to another piece of code, that just says I’m ready to repaint now, so let me reapply this function and that will give me a picture and I’ll draw that.’
So from a rather imperative notion of values that evolve over time, it turned it into a purely declarative idea of a value that describes the position of the ball at any time. Based on that simple idea Conal was able to describe lots of beautiful animations and ways of describing dynamics and things moving around and bouncing into one another in a very simple and beautiful way. And I had never thought of that. It expanded my idea of what a value might be.
What was surprising about it was that I didn’t expect that that could be done in that way at all, in fact I had never thought about it. Haskell the language had allowed Conal to think sophisticated thoughts and express them as a programmer, and I thought that was pretty cool. This actually happens quite a lot as Haskell is a very high level programming language, so people that think big thoughts can do big things in it.
Join the Computerworld Australia group on Linkedin. The group is open to IT Directors, IT Managers, Infrastructure Managers, Network Managers, Security Managers, Communications Managers.
- Bookmark this page
- Share this article
- Got more on this story? Email Computerworld
- Follow Computerworld on twitter
- The A-Z of Programming Languages: AWK
- The A-Z of Programming Languages: Ada
- The A-Z of Programming Languages: ASP
- The A-Z of Programming Languages: BASH/Bourne-Again Shell
- The A-Z of Programming Languages: C++
- The A-Z of Programming Languages: Forth
- The A-Z of Programming Languages: INTERCAL
- The A-Z of Programming Languages: YACC
- The A-Z of Programming Languages: Modula-3
- The A-Z of Programming Languages: D
- The A-Z of Programming Languages: JavaScript
- The A-Z of Programming Languages: Python
- The A-Z of Programming Languages: Lua
-
Australia remains black spot for Vodafone
-
Australia remains black spot for Vodafone
-
How to provide IT support to a dispersed workforce
-
Intel claims Haswell will offer 50 per cent more battery life in laptops
-
Intel claims Haswell will offer 50 per cent more battery life in laptops












Comments
Anonymous
1
to the editor
Hi there,
how about an iterview on Standard ML?
Anonymous
2
Scala
I'd like to here an interview about new and fast emerging Scala language. It takes a niche in Java world similar to F# in Microsoft world.
http://www.scala-lang.org/
CSMR
3
Great interview, easy to understand and learned a lot.
OCamler
4
Terrific interview! (Hard to go wrong with Simon P.J. -- he's always entertaining. :-)
I'd very interested to see an interview on OCaml, including some discussion to do with OCaml v. Haskell for different applications.
Cheers.