
pete-expires-20070615:
Simon Peyton-Jones
writes: My guess is that they'll be Linux/Perl/Ruby types, and they'll be practitioners rather than pointy-headed academics.
Suggest concrete examples of programs that are * small * useful * demonstrate Haskell's power * preferably something that might be a bit tricky in another language
But there must be lots of others.
As one of those python/ruby types trying to learn Haskell for the past year, here are my suggestions for small examples:
- Tom Moertel's Haskell Port Scanner Why? Demonstrates concurrent haskell in a small amount of lines http://blog.moertel.com/articles/2004/03/13/concurrent-port-scanner-in-haske...
- A web-server example of some sort that interfaces with a database and uses some interesting HTML combinator library.
- Building a simple unit testing framework is always a good example (even though they already exist), and then introducing quickcheck perhaps.
It's interesting to note that QuickCheck generalises unit testing: zero-arity QC properties are exactly unit tests.
- A program to concurrently verify the links on an HTML page recursively. I'm sure there are lots of interesting idioms and techniques that could be used while keeping the code small and elegant.
Ah, there's a (parallel) program I wrote for this, urlcheck. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/urlcheck-0.1 I had meant to use this as a basis for a blog article, but didn't get around to it.
- Perhaps a Haskell version of Norvig's 20-line Python Spell Checker: Why? Maybe a Haskell version could be shorter and more elegant? http://norvig.com/spell-correct.html
- Tom Moertel's Directory Tree Printing in Haskell: Why? Demonstrates all sorts of introductory techniques http://blog.moertel.com/articles/2007/03/28/directory-tree-printing-in-haske...
Some thoughts on other topics suggested by others:
- Parsec is not that interesting for those coming from perl, ruby, or python as they rely on regular expressions for everything and just expect that they are part of the language. The thought of writing one's own parser is not as "cool" as most Haskellers believe it is, regardless of how interesting the parsec library is.
That's a useful insight.
- STM may be too complex of a subject for an intro to Haskell tutorial. There are just too many concepts in there that may overwhelm some beginners.
- Don's post on shell scripting was very interesting, but I'm still having a hard time understanding some parts of it, the error handling part, and I've been playing with Haskell on and off for the past year (I'm also a slow learner and not an academic).
Interesting! Thanks for the feedback.
- Don's post on simple UNIX utilities was also quite nice. I believe he also wrote a simple IRC bot example that would prove interesting, can't seem to find the link at the moment though.
http://haskell.org/haskellwiki/Roll_your_own_IRC_bot
Just my thoughts as a newbie desiring a book on how to use Haskell in a practical manner (such as Practical Common Lisp book).
Don't we all! :-) -- Don