Re: [Haskell-cafe] Tutorial on Haskell: Use closures

2007-04-22 Thread Paul Johnson
Closures look like magic to those who don't know them. So you might try something like this (which I have not compiled BTW): -- Haskell version data Train = Train {departs :: Time, platform :: Int } departsBefore :: Time - Train - Bool departsBefore t train = t departs train

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-18 Thread Neil Davies
Yep - I've seen it in course work I've set in the past - random walk through the arrangement of symbols in the language (it was a process algebra work and proof system to check deadlock freedom). ... but ... Haskell even helps those people - if you've created something that works (and you are

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-18 Thread Dougal Stanton
On 18/04/07, R Hayes [EMAIL PROTECTED] wrote: One of the truly powerful things about Haskell is the short distance between theory and practicality. The problem is how to demonstrate this convincingly. The ability to prove a program's correctness is regularly trotted out for show in this arena

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-18 Thread Chris Kuklewicz
Dougal Stanton wrote: *QuickCheck is a really powerful way to work.* The real pain in the butt with unit tests is having to write the damn things. Especially for corner cases - if they were easy to reason about they wouldn't really be corner cases, would they? QC allows you to sidestep

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-18 Thread Derek Elkins
Dougal Stanton wrote: On 18/04/07, R Hayes [EMAIL PROTECTED] wrote: One of the truly powerful things about Haskell is the short distance between theory and practicality. The problem is how to demonstrate this convincingly. The ability to prove a program's correctness is regularly trotted

RE: [Haskell-cafe] Tutorial on Haskell

2007-04-18 Thread Taillefer, Troy (EXP)
I guess it is time to give my two cents on this topic I am definitely not an expert Haskell programmer I am a mere hobbyist I make my bread coding Java/C++/C. I think the two things I like most about Haskell are 1. Its methods of combination Lazy Eval, Function composition and Higher order

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-18 Thread Sebastian Sylvan
On 4/18/07, Taillefer, Troy (EXP) [EMAIL PROTECTED] wrote: I have to strongly disagree with the statement that developers like to debug. Debugging is necessary because you can't reason about any sizeable piece of code just is not tractable even in Haskell. Now automated tools for reasoning

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-18 Thread Nicolas Frisby
Here here. This reminds me of a recent discussion on the cafe. Thee OP amounted to: What are the monad laws good for?. The answer was: It means the monad doesn't do surprising things and its behavior is congruent with the basic intuitions of sequenced computation. In my eyes, proving nice

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-18 Thread Juan Carlos Arevalo Baeza
I still love Haskell, but... since the language doesn't do batshit insane things behind your back - Hmmm... I'd contend that the Haskell language is the one language that does the most batshit insane things behind your back, for instance list fusion. This is probably because there

FW: [Haskell-cafe] Tutorial on Haskell

2007-04-18 Thread Taillefer, Troy (EXP)
-cafe@haskell.org Subject: Re: [Haskell-cafe] Tutorial on Haskell On 4/18/07, Taillefer, Troy (EXP) [EMAIL PROTECTED] wrote: I have to strongly disagree with the statement that developers like to debug. Debugging is necessary because you can't reason about any

Re: FW: [Haskell-cafe] Tutorial on Haskell

2007-04-18 Thread Sebastian Sylvan
On 4/18/07, Taillefer, Troy (EXP) [EMAIL PROTECTED] wrote: Sorry for the long rant but I get tired of people with their juvenile and unconstructive statements like C++ sucks Or Language X is better then Language Y even if it could ever be objectively true (which I am sorry it can't be) who

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-18 Thread Michael Vanier
As one who teaches programming in a lot of different languages, I can state unequivocally that strong static typing of the Haskell or Ocaml variety is (in addition to all its other benefits) a godsend to the instructor. So many incorrect ways of writing programs are simply ruled out right at

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-17 Thread ajb
G'day all. I wrote: I think you could. What you need to convince a strict programmer of is that laziness gives you modularity. The Graham Hutton Sudoku solver is a nice example, but it'd be cool if we had a similar example that was less cheesy than Sudoku. OK, it's not pretty, but this is

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-17 Thread R Hayes
In my opinion, one of the things that makes Haskell difficult to learn is the value system. I'm not referring to pure vs. impure. Instead, I am referring to the beliefs and principles held by the Haskell community that are not shared with most of the programming world. Principles like

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-17 Thread David Brown
R Hayes wrote: They *enjoy* debugging ... I have to say this is one of the best things I've found for catching bad programmers during interviews, no matter what kind of system it is for. I learned this the hard way after watching someone who never really understood her program, but just kept

[Haskell-cafe] Tutorial on Haskell

2007-04-17 Thread dfeustel
What would be really useful is a Haskell Cookbook that shows how to do in Haskell things that are so easily done in imperative languages. How to solve simultaneous equations using Gaussian elimination comes to mind. Lots of examples would be great. Dave Feustel

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-17 Thread R Hayes
On Apr 17, 2007, at 4:46 PM, David Brown wrote: R Hayes wrote: They *enjoy* debugging ... I have to say this is one of the best things I've found for catching bad programmers during interviews, no matter what kind of system it is for. I learned this the hard way after watching someone

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-17 Thread Michael Vanier
R Hayes wrote: On Apr 17, 2007, at 4:46 PM, David Brown wrote: R Hayes wrote: They *enjoy* debugging ... I have to say this is one of the best things I've found for catching bad programmers during interviews, no matter what kind of system it is for. I learned this the hard way after

[Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Simon Peyton-Jones
Friends I have agreed to give a 3-hr tutorial on Haskell at the Open Source Convention 2007 http://conferences.oreillynet.com/os2007/ I'm quite excited about this: it is a great opportunity to expose Haskell to a bunch of smart folk, many of whom won't know much about Haskell. My

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Steffen Mazanek
What about demonstrating the use of an Haskell interpreter as a pimped up calculator? multTable = putStr $ unlines [unlines [show x ++ ' ':show y ++ ' ':show (x*y)|y-[1..10]] | x-[1..10]] 2007/4/16, Simon Peyton-Jones [EMAIL PROTECTED]: Friends I have agreed to give a 3-hr tutorial on

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Thomas Hartman
Give them a program that selects a bunch of files based on some filtering criteria, and then does something to each file. Kind of like find + xargs, but using haskell instead. Good recipe for sysadmins. There was a recent example involving parsing raw emails into a thread here

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Dougal Stanton
On 16/04/07, Thomas Hartman [EMAIL PROTECTED] wrote: Maybe that could be simplified and something could be based on that. A one-liner using PCRE regex might also be of use. Unless it can be performed with astounding dexterity, I don't think try to beat, for example, Perl at its own game

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Thomas Hartman
There may be something to this point of view. On the other hand, it is easier for me to see examples that can connect back to something I am already familiar with. That said, I will mention something where perl *seemed* to be a fit, but later proved frustrating. To whit -- Doing something at

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Neil Bartlett
Well, given that concurrency is a hot topic at the moment, how about something based on STM? E.g. perhaps some kind of instant messaging server? Or Twitter except scalable. By ruthlessly eliminating features, you could get the core of one of these down to something that could be built in three

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Ketil Malde
apart, as long as the type checker agrees the pieces all fit back together, the program works as i expect it to. (Perhaps not so easy to apply this to a tutorial setting?) -k ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Ketil Malde
On Mon, 2007-04-16 at 11:06 +0100, Dougal Stanton wrote: A one-liner using PCRE regex might also be of use. Unless it can be performed with astounding dexterity, I don't think try to beat, for example, Perl at its own game will produce worthwhile results. One possibility is a task where

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Sebastian Sylvan
On 4/16/07, Ketil Malde [EMAIL PROTECTED] wrote: On Mon, 2007-04-16 at 13:27 +0200, Thomas Hartman wrote: To recap: transform a piece of simple code that works in serial, so it works in parallel. Maybe even a couple, or three ways: using forks, using threads, using map reduce. This made me

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Hans van Thiel
On Mon, 2007-04-16 at 09:34 +0100, Simon Peyton-Jones wrote: Friends I have agreed to give a 3-hr tutorial on Haskell at the Open Source Convention 2007 http://conferences.oreillynet.com/os2007/ I'm quite excited about this: it is a great opportunity to expose Haskell to a

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Neil Mitchell
Hi I think its important to cover whats different about Haskell. Things like laziness are cool, but are harder to convince a strict programmer that they are useful. Types however are obviously very handy, if you can focus on why a Haskell program is so obviously correct easily. 1) the type

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Derek Elkins
Hans van Thiel wrote: On Mon, 2007-04-16 at 09:34 +0100, Simon Peyton-Jones wrote: Friends I have agreed to give a 3-hr tutorial on Haskell at the Open Source Convention 2007 http://conferences.oreillynet.com/os2007/ I'm quite excited about this: it is a great opportunity to expose

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Nicolas Frisby
One technique I find compelling is (ab)using the type class system for meta programming. Something from Lightweight Static Resources, Faking It, or Hinze's Full Circle slides might be really attractive. Perhaps Danvy's Haskell printf? The hook might be: Yeah, you've heard of strong static typing

RE: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Taillefer, Troy (EXP)
AM To: haskell-cafe@haskell.org Subject: [Haskell-cafe] Tutorial on Haskell Friends I have agreed to give a 3-hr tutorial on Haskell at the Open Source Convention 2007 http://conferences.oreillynet.com/os2007/ I'm quite excited about this: it is a great opportunity to expose Haskell

RE: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Simon Peyton-Jones
; haskell-cafe@haskell.org | Subject: RE: [Haskell-cafe] Tutorial on Haskell | | Simon, | | Hopefully a video of this tutorial would be made available as a learning | resource for those of use who can't make it to this Convention. | | Troy | | | -Original Message- | From: [EMAIL PROTECTED] | [mailto

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Mark T.B. Carroll
Neil Mitchell [EMAIL PROTECTED] writes: (snip) I think its important to cover whats different about Haskell. Things like laziness are cool, but are harder to convince a strict programmer that they are useful. (snip) Mmmm, it took me a while to really find laziness useful, and that was normally

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Justin Bailey
I found this blog post, which describes a way to protect against SQL injection attacks using the type system, to be really enlightening. http://blog.moertel.com/articles/2006/10/18/a-type-based-solution-to-the-strings-problem Justin ___ Haskell-Cafe

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Aaron Tomb
Having just read Simon Marlow's paper on the Haskell Web Server, I think it might be interesting to at least mention it, and how simple it is, while still performing well. Also, I second the comment several have made so far that talking about concurrency is important. Haskell does it

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Bryan O'Sullivan
Mark T.B. Carroll wrote: I'm afraid no examples come easily to mind, though. Here's a simple one: reading a flattened graph from disk. If your flattened representation contains forward references, you have to fix them up in a strict language. In a lazy language, you can refer to elements

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Mark T.B. Carroll
Bryan O'Sullivan [EMAIL PROTECTED] writes: Mark T.B. Carroll wrote: I'm afraid no examples come easily to mind, though. Here's a simple one: reading a flattened graph from disk. If your flattened representation contains forward references, you have to fix them up in a strict language.

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Bryan O'Sullivan
Neil Bartlett wrote: E.g. perhaps some kind of instant messaging server? Or Twitter except scalable. A twitter-alike will quite probably get people's attention. And of course anything that breaks the it's good for compilers! stereotype is to be commended :-) Also on the subject of

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Derek Elkins
Mark T.B. Carroll wrote: Bryan O'Sullivan [EMAIL PROTECTED] writes: Mark T.B. Carroll wrote: I'm afraid no examples come easily to mind, though. Here's a simple one: reading a flattened graph from disk. If your flattened representation contains forward references, you have to fix them up

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Albert Y. C. Lai
Neil Mitchell wrote: Things like laziness are cool, but are harder to convince a strict programmer that they are useful. Strict programmers like the yield command too. The same behaviour can be obtained by laziness, with easier reasoning. That said, strict programmers may or may not like

Fwd: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Ryan Dickie
Blast.. i didn't hit reply all so here's a forward of my mail to the group... --ryan -- Forwarded message -- From: Ryan Dickie [EMAIL PROTECTED] Date: Apr 16, 2007 4:24 PM Subject: Re: [Haskell-cafe] Tutorial on Haskell To: Simon Peyton-Jones [EMAIL PROTECTED] I can tell you

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread ajb
G'day all. Quoting Neil Mitchell [EMAIL PROTECTED]: I think its important to cover whats different about Haskell. Things like laziness are cool, but are harder to convince a strict programmer that they are useful. I think you could. What you need to convince a strict programmer of is that