I recommend checking out Don Syme's slides from CUFP 2008. http://cufp.galois.com/2008/slides/
This isn't Haskell directly, it's F#, but it fits the "functional programming generally", and the two languages have, relative to the universe of programming languages, more in common than they do different. There's a lot of "would you rather write this?" with a giant chunk of C#, followed by "or this?" with a few readable lines of F#. -- ryan On Tue, Jan 20, 2009 at 2:07 AM, Jim Burton <[email protected]> wrote: > Hi, I will be a TA on a comparative PL course and I'm looking for > small examples (ammunition) which motivate the use of Haskell and > functional programming generally. The course is for 1st year Software > Engineers, none of whom are likely to have used a functional > language. They will all have experience programming Java and a little > C++, with a few of them knowing Python, Ruby, PHP etc etc too. > > If anyone has code snippets which are the equivalent of an elevator > pitch for FP, I would be very grateful to see them. What I want > are some small concrete examples of idioms which are natural and > powerful in Haskell but difficult or impossible in, say, Java. > > So I can produce examples of some of the things that make FP powerful, > elegant, expressive etc: higher order functions, polymorphism, > composition (ask them to write (.) in Java :-)), partial application > and so on. I will point any interested souls to Hughes' great paper > [1]. But I have little time and it might be hard to put across why > they would want to do these things in the first place. I was looking > for something that speaks directly to the kind of problems they face > in languages like Java... > > Types are a good example because Java programmers generally already > appreciate the help they get from compiler messages etc, so you can > sell a more flexible, enhanced form of this. Purity might appeal to > anyone who has longed to be able to reason about nastily complex code > with a lot of shared state. Laziness, streams? Hard to do in Java (I > presume) but also quite hard to sell the need. > > The existence of an O'Reilly book will help, especially one that can > be sampled online, so I'll point them at RWH for extended concrete > examples. They will need to be already sold before they will bother > with that though. > > Thanks, > > Jim > > [1] http://www.cs.chalmers.se/~rjmh/Papers/whyfp.html > _______________________________________________ > Haskell-Cafe mailing list > [email protected] > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
