Haskell showcase in 5 minutes

Hello Cafe, I will be (re)presenting Haskell in a "Batlle Language" event Wednesday evening: A fun and interactive contest where various programming language champions try to attract as much followers as possible in 5 minutes. Having successfully experimented the power of live coding in a recent Haskell introduction for the Paris Scala User Group, I would like to do the same but given the time frame I need a simpler example than the music synthesizer program. So I would like to tap in the collective wisdom looking for some concise, eye-opening, mind-shaking and if possible fun example of what one can achieve in Haskell. Things that sprung to my mind are rather dull: prime factors, fibonacci numbers. Thanks in advance, Arnaud

Arnaud Bailly
I will be (re)presenting Haskell in a "Batlle Language" event Wednesday evening: A fun and interactive contest where various programming language champions try to attract as much followers as possible in 5 minutes.
Having successfully experimented the power of live coding in a recent Haskell introduction for the Paris Scala User Group, I would like to do the same but given the time frame I need a simpler example than the music synthesizer program.
So I would like to tap in the collective wisdom looking for some concise, eye-opening, mind-shaking and if possible fun example of what one can achieve in Haskell. Things that sprung to my mind are rather dull: prime factors, fibonacci numbers.
Well, the first thing that comes to mind is Yesod: If you trained, you can very well build a complete blog application with Markdown syntax support and comment functionality within that time frame. Of course it won't be enough to explain every detail, but you can list the key features: * (static!) safety of, well, everything, * insanely easy database handling, * performance, * rapid development, * Lucius (a cascading language for cascading stylesheets =)), * composability (i.e. widgets), * a comprehensive prefab toolbox (login, sitemaps, etc.). However, five minutes is a very narrow time frame, so better have some editor macros ready. Also practice, practice, practice. Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/

On Mon, Feb 27, 2012 at 7:18 AM, Arnaud Bailly
Hello Cafe,
I will be (re)presenting Haskell in a "Batlle Language" event Wednesday evening: A fun and interactive contest where various programming language champions try to attract as much followers as possible in 5 minutes.
Having successfully experimented the power of live coding in a recent Haskell introduction for the Paris Scala User Group, I would like to do the same but given the time frame I need a simpler example than the music synthesizer program.
So I would like to tap in the collective wisdom looking for some concise, eye-opening, mind-shaking and if possible fun example of what one can achieve in Haskell. Things that sprung to my mind are rather dull: prime factors, fibonacci numbers.
Poke around Oleg's website. If you think people would be wowed by type hacks then you can find examples where: * he encodes the law of excluded middle using Haskell types (plus type classes) (http://okmij.org/ftp/Computation/lem.html) * he shows a way to encode arbitrary values in types and then recover them again (http://www.cs.rutgers.edu/~ccshan/prepose/prepose.pdf) He has more than just type hacks, check out his Haskell section: http://okmij.org/ftp/Haskell/ I hope that helps, Jason

In less than 5 minutes I can solve NP-Complete problems in restaurant orders: http://www.reddit.com/comments/24p2c/xkcd_does_anyone_else_feel_compelled_to... On Mon, 27 Feb 2012, Arnaud Bailly wrote:
Hello Cafe,
I will be (re)presenting Haskell in a "Batlle Language" event Wednesday evening: A fun and interactive contest where various programming language champions try to attract as much followers as possible in 5 minutes.
Having successfully experimented the power of live coding in a recent Haskell introduction for the Paris Scala User Group, I would like to do the same but given the time frame I need a simpler example than the music synthesizer program.
So I would like to tap in the collective wisdom looking for some concise, eye-opening, mind-shaking and if possible fun example of what one can achieve in Haskell. Things that sprung to my mind are rather dull: prime factors, fibonacci numbers.
Thanks in advance, Arnaud
-- Russell O'Connor http://r6.ca/ ``All talk about `theft,''' the general counsel of the American Graphophone Company wrote, ``is the merest claptrap, for there exists no property in ideas musical, literary or artistic, except as defined by statute.''

Well, solving knapsack problem in a couple lines of code looks really fun
and instructive.
Thanks Ertugrul for suggesting Yesod. This is definitely a great tool for
creating web applications but I fear that's too much to swallow in 5
minutes. And thanks also Jason for reminding me of the gems one can find in
Oleg's treasures trove but given the expected attendance, that's maybe too
much type wizardry. However, I remember having written an arab to roman
numerals converter based on type system which could be fun also.
Regards,
Arnaud
On Mon, Feb 27, 2012 at 10:36 PM,
In less than 5 minutes I can solve NP-Complete problems in restaurant orders:
http://www.reddit.com/**comments/24p2c/xkcd_does_** anyone_else_feel_compelled_to_**solve_this/c24pc5http://www.reddit.com/comments/24p2c/xkcd_does_anyone_else_feel_compelled_to...
On Mon, 27 Feb 2012, Arnaud Bailly wrote:
Hello Cafe,
I will be (re)presenting Haskell in a "Batlle Language" event Wednesday evening: A fun and interactive contest where various programming language champions try to attract as much followers as possible in 5 minutes.
Having successfully experimented the power of live coding in a recent Haskell introduction for the Paris Scala User Group, I would like to do the same but given the time frame I need a simpler example than the music synthesizer program.
So I would like to tap in the collective wisdom looking for some concise, eye-opening, mind-shaking and if possible fun example of what one can achieve in Haskell. Things that sprung to my mind are rather dull: prime factors, fibonacci numbers.
Thanks in advance, Arnaud
-- Russell O'Connor http://r6.ca/ ``All talk about `theft,''' the general counsel of the American Graphophone Company wrote, ``is the merest claptrap, for there exists no property in ideas musical, literary or artistic, except as defined by statute.''

On 12-02-27 04:36 PM, roconnor@theorem.ca wrote:
In less than 5 minutes I can solve NP-Complete problems in restaurant orders:
http://www.reddit.com/comments/24p2c/xkcd_does_anyone_else_feel_compelled_to...
and right in haskell-cafe: http://www.mail-archive.com/haskell-cafe@haskell.org/msg26459.html http://www.mail-archive.com/haskell-cafe@haskell.org/msg27286.html

Where exactly does that event take place?
Is it open to public?
And I strongly disadvise fibonacci, quicksort and other mind-blowing
reality-escapist stuff. Show something real world and practical.
2012/2/27 Arnaud Bailly
Hello Cafe,
I will be (re)presenting Haskell in a "Batlle Language" event Wednesday evening: A fun and interactive contest where various programming language champions try to attract as much followers as possible in 5 minutes.
Having successfully experimented the power of live coding in a recent Haskell introduction for the Paris Scala User Group, I would like to do the same but given the time frame I need a simpler example than the music synthesizer program.
So I would like to tap in the collective wisdom looking for some concise, eye-opening, mind-shaking and if possible fun example of what one can achieve in Haskell. Things that sprung to my mind are rather dull: prime factors, fibonacci numbers.
Thanks in advance, Arnaud
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Nevermind, I think I found:
http://jduchess.org/duchess-france/blog/battle-language-a-la-marmite/
You could try the JSON parser exercise. (
https://github.com/revence27/JSON-hs) Or anything else with Parsec, it's a
pretty good power-showing library.
2012/2/28 Yves Parès
Where exactly does that event take place? Is it open to public?
And I strongly disadvise fibonacci, quicksort and other mind-blowing reality-escapist stuff. Show something real world and practical.
2012/2/27 Arnaud Bailly
Hello Cafe,
I will be (re)presenting Haskell in a "Batlle Language" event Wednesday evening: A fun and interactive contest where various programming language champions try to attract as much followers as possible in 5 minutes.
Having successfully experimented the power of live coding in a recent Haskell introduction for the Paris Scala User Group, I would like to do the same but given the time frame I need a simpler example than the music synthesizer program.
So I would like to tap in the collective wisdom looking for some concise, eye-opening, mind-shaking and if possible fun example of what one can achieve in Haskell. Things that sprung to my mind are rather dull: prime factors, fibonacci numbers.
Thanks in advance, Arnaud
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Thanks Yves for your advice. And I agree with you that too much laziness
may be mind-blowing for most of the audience, yet this is one of the
characteristics of Haskell, whether or not we like it and whatever troubles
it can induce.
I really think the knapsack is simple, not too far away from real world and
might be demonstrated with live code in 5 minutes. I will have a look
anyway at more "spectacular" stuff like gloss or yesod but I fear this is
out of scope.
Regards,
Arnaud
On Tue, Feb 28, 2012 at 12:27 PM, Yves Parès
Nevermind, I think I found: http://jduchess.org/duchess-france/blog/battle-language-a-la-marmite/
You could try the JSON parser exercise. ( https://github.com/revence27/JSON-hs) Or anything else with Parsec, it's a pretty good power-showing library.
2012/2/28 Yves Parès
Where exactly does that event take place? Is it open to public?
And I strongly disadvise fibonacci, quicksort and other mind-blowing reality-escapist stuff. Show something real world and practical.
2012/2/27 Arnaud Bailly
Hello Cafe,
I will be (re)presenting Haskell in a "Batlle Language" event Wednesday evening: A fun and interactive contest where various programming language champions try to attract as much followers as possible in 5 minutes.
Having successfully experimented the power of live coding in a recent Haskell introduction for the Paris Scala User Group, I would like to do the same but given the time frame I need a simpler example than the music synthesizer program.
So I would like to tap in the collective wisdom looking for some concise, eye-opening, mind-shaking and if possible fun example of what one can achieve in Haskell. Things that sprung to my mind are rather dull: prime factors, fibonacci numbers.
Thanks in advance, Arnaud
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Tue, Feb 28, 2012 at 14:05, Arnaud Bailly
Thanks Yves for your advice. And I agree with you that too much laziness may be mind-blowing for most of the audience, yet this is one of the characteristics of Haskell, whether or not we like it and whatever troubles it can induce.
I really think the knapsack is simple, not too far away from real world and might be demonstrated with live code in 5 minutes. I will have a look anyway at more "spectacular" stuff like gloss or yesod but I fear this is out of scope.
If it suits the medium, you could always throw up a one-liner (e.g. fibonacci from a recursive list) at the end and just leave it there without explanation, for the audience to feel the awesomeness of Haskell ;) /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus@therning.org jabber: magnus@therning.org twitter: magthe http://therning.org/magnus

Arnaud Bailly
Thanks Yves for your advice. And I agree with you that too much laziness may be mind-blowing for most of the audience, yet this is one of the characteristics of Haskell, whether or not we like it and whatever troubles it can induce.
I really think the knapsack is simple, not too far away from real world and might be demonstrated with live code in 5 minutes. I will have a look anyway at more "spectacular" stuff like gloss or yesod but I fear this is out of scope.
Gloss is definitely not out of scope. It is to simple 2D graphics what Yesod is to web applications. I write two-minutes visualizations using it all the time. Of course if you want to show something great, you shouldn't fear learning it first. Also showing the language features, despite their greatness, makes people go like: "Ok, that's great, but I can do it in my language using <insert control construct here>". If you really don't want to go for something amazing like Diagrams, Gloss or Yesod, I really suggest at least bringing the run-time system into the game. Show concurrency, STM and parallel evaluation. Show how you can write a full-featured finger server in five minutes that is fast, secure and amazingly readable. Something like that. Math problems amaze Haskellers, not programmers in general. Show how Haskell solves practical problems, for which there is no simple solution in more common languages. Don't show why Haskell is also good. Show why Haskell is /a lot better/. Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/

Gloss having been mentioned, I thought I'd look into it. m% cabal install gloss Resolving dependencies... cabal: cannot configure gloss-1.6.1.1. It requires base ==4.5.* For the dependency on base ==4.5.* there are these packages: base-4.5.0.0. However none of them are available. base-4.5.0.0 was excluded because of the top level dependency base -any What did I do wrong?

On 29 February 2012 08:40, Richard O'Keefe
Gloss having been mentioned, I thought I'd look into it.
m% cabal install gloss Resolving dependencies... cabal: cannot configure gloss-1.6.1.1. It requires base ==4.5.* For the dependency on base ==4.5.* there are these packages: base-4.5.0.0. However none of them are available. base-4.5.0.0 was excluded because of the top level dependency base -any
What did I do wrong?
I believe the newest version of gloss requires GHC-7.4; the 1.5 series builds with older versions of GHC.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com http://IvanMiljenovic.wordpress.com

Thanks for your support. I would really like to do this but 1) the talk is
tomorrow evening and 2) I do not have time in the interval to learn yesod
and/or gloss enough to be confident that I will not botch anything in a 5
minutes time frame.
I did recently a 2-hours long talk with same purpose (introducing Haskell
to an audience of mixed-level Scala programmers), using some code to
produce sound and music, up to a web server for generating wav files from
"scores", and I had to make giant steps in the last 15 minutes to get to
the web stuff. There was a lot of questions right from the start on various
"strange" aspects of the language : type inference, laziness, generalized
tail recursion, monadic I/O, point-free definitions and I barely managed to
keep some time to show how easy it is to write a web server with simple
HTML combinators (I discovered miku in the process).
I timed myself on the menu problem and I am a little bit under 5 minutes,
given I want to explain quite a few things in the process: what you can do
with lists, what you can do with pairs, how to simply generate all the
combinations of elements of a list, how to map a function on list, how to
use list-comprehensions to integrate everything into a concise form and how
to avoid combinatorial blow-up through laziness.
I also would love to have the time to show some cool concurrency stuff
following your suggestion. I will try to pack this tomorrow.
Thanks a lot again for your advices,
Arnaud
2012/2/28 Ertugrul Söylemez
Arnaud Bailly
wrote: Thanks Yves for your advice. And I agree with you that too much laziness may be mind-blowing for most of the audience, yet this is one of the characteristics of Haskell, whether or not we like it and whatever troubles it can induce.
I really think the knapsack is simple, not too far away from real world and might be demonstrated with live code in 5 minutes. I will have a look anyway at more "spectacular" stuff like gloss or yesod but I fear this is out of scope.
Gloss is definitely not out of scope. It is to simple 2D graphics what Yesod is to web applications. I write two-minutes visualizations using it all the time. Of course if you want to show something great, you shouldn't fear learning it first.
Also showing the language features, despite their greatness, makes people go like: "Ok, that's great, but I can do it in my language using <insert control construct here>". If you really don't want to go for something amazing like Diagrams, Gloss or Yesod, I really suggest at least bringing the run-time system into the game. Show concurrency, STM and parallel evaluation. Show how you can write a full-featured finger server in five minutes that is fast, secure and amazingly readable. Something like that.
Math problems amaze Haskellers, not programmers in general. Show how Haskell solves practical problems, for which there is no simple solution in more common languages. Don't show why Haskell is also good. Show why Haskell is /a lot better/.
Greets, Ertugrul
-- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Yes, but in 5 minutes I take it they won't have time to ask questions
before your presentation is over.
I haven't thought about parallel computing but it's one of the many assets
of the language.
The problem IMHO with STM is that it relies on too many Haskell elements to
be grasped in 5 minutes. Monads, Monoids, you name it. You can't still
present it, but bare in mind people will just understand the vague idea.
There are so many cool things to show... ;). (But that's true for any
expressive language)
Oh, BTW I'm coming to the Battle Language tonight.
2012/2/28 Arnaud Bailly
Thanks for your support. I would really like to do this but 1) the talk is tomorrow evening and 2) I do not have time in the interval to learn yesod and/or gloss enough to be confident that I will not botch anything in a 5 minutes time frame.
I did recently a 2-hours long talk with same purpose (introducing Haskell to an audience of mixed-level Scala programmers), using some code to produce sound and music, up to a web server for generating wav files from "scores", and I had to make giant steps in the last 15 minutes to get to the web stuff. There was a lot of questions right from the start on various "strange" aspects of the language : type inference, laziness, generalized tail recursion, monadic I/O, point-free definitions and I barely managed to keep some time to show how easy it is to write a web server with simple HTML combinators (I discovered miku in the process).
I timed myself on the menu problem and I am a little bit under 5 minutes, given I want to explain quite a few things in the process: what you can do with lists, what you can do with pairs, how to simply generate all the combinations of elements of a list, how to map a function on list, how to use list-comprehensions to integrate everything into a concise form and how to avoid combinatorial blow-up through laziness.
I also would love to have the time to show some cool concurrency stuff following your suggestion. I will try to pack this tomorrow.
Thanks a lot again for your advices,
Arnaud
2012/2/28 Ertugrul Söylemez
Arnaud Bailly
wrote: Thanks Yves for your advice. And I agree with you that too much laziness may be mind-blowing for most of the audience, yet this is one of the characteristics of Haskell, whether or not we like it and whatever troubles it can induce.
I really think the knapsack is simple, not too far away from real world and might be demonstrated with live code in 5 minutes. I will have a look anyway at more "spectacular" stuff like gloss or yesod but I fear this is out of scope.
Gloss is definitely not out of scope. It is to simple 2D graphics what Yesod is to web applications. I write two-minutes visualizations using it all the time. Of course if you want to show something great, you shouldn't fear learning it first.
Also showing the language features, despite their greatness, makes people go like: "Ok, that's great, but I can do it in my language using <insert control construct here>". If you really don't want to go for something amazing like Diagrams, Gloss or Yesod, I really suggest at least bringing the run-time system into the game. Show concurrency, STM and parallel evaluation. Show how you can write a full-featured finger server in five minutes that is fast, secure and amazingly readable. Something like that.
Math problems amaze Haskellers, not programmers in general. Show how Haskell solves practical problems, for which there is no simple solution in more common languages. Don't show why Haskell is also good. Show why Haskell is /a lot better/.
Greets, Ertugrul
-- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Great ! Good to have some support. Hope you will like it, I think I got
something worthwhile that fits in 5 minutes flat.
On Wed, Feb 29, 2012 at 10:46 AM, Yves Parès
Yes, but in 5 minutes I take it they won't have time to ask questions before your presentation is over.
I haven't thought about parallel computing but it's one of the many assets of the language. The problem IMHO with STM is that it relies on too many Haskell elements to be grasped in 5 minutes. Monads, Monoids, you name it. You can't still present it, but bare in mind people will just understand the vague idea. There are so many cool things to show... ;). (But that's true for any expressive language)
Oh, BTW I'm coming to the Battle Language tonight.
2012/2/28 Arnaud Bailly
Thanks for your support. I would really like to do this but 1) the talk is tomorrow evening and 2) I do not have time in the interval to learn yesod and/or gloss enough to be confident that I will not botch anything in a 5 minutes time frame.
I did recently a 2-hours long talk with same purpose (introducing Haskell to an audience of mixed-level Scala programmers), using some code to produce sound and music, up to a web server for generating wav files from "scores", and I had to make giant steps in the last 15 minutes to get to the web stuff. There was a lot of questions right from the start on various "strange" aspects of the language : type inference, laziness, generalized tail recursion, monadic I/O, point-free definitions and I barely managed to keep some time to show how easy it is to write a web server with simple HTML combinators (I discovered miku in the process).
I timed myself on the menu problem and I am a little bit under 5 minutes, given I want to explain quite a few things in the process: what you can do with lists, what you can do with pairs, how to simply generate all the combinations of elements of a list, how to map a function on list, how to use list-comprehensions to integrate everything into a concise form and how to avoid combinatorial blow-up through laziness.
I also would love to have the time to show some cool concurrency stuff following your suggestion. I will try to pack this tomorrow.
Thanks a lot again for your advices,
Arnaud
2012/2/28 Ertugrul Söylemez
Arnaud Bailly
wrote: Thanks Yves for your advice. And I agree with you that too much laziness may be mind-blowing for most of the audience, yet this is one of the characteristics of Haskell, whether or not we like it and whatever troubles it can induce.
I really think the knapsack is simple, not too far away from real world and might be demonstrated with live code in 5 minutes. I will have a look anyway at more "spectacular" stuff like gloss or yesod but I fear this is out of scope.
Gloss is definitely not out of scope. It is to simple 2D graphics what Yesod is to web applications. I write two-minutes visualizations using it all the time. Of course if you want to show something great, you shouldn't fear learning it first.
Also showing the language features, despite their greatness, makes people go like: "Ok, that's great, but I can do it in my language using <insert control construct here>". If you really don't want to go for something amazing like Diagrams, Gloss or Yesod, I really suggest at least bringing the run-time system into the game. Show concurrency, STM and parallel evaluation. Show how you can write a full-featured finger server in five minutes that is fast, secure and amazingly readable. Something like that.
Math problems amaze Haskellers, not programmers in general. Show how Haskell solves practical problems, for which there is no simple solution in more common languages. Don't show why Haskell is also good. Show why Haskell is /a lot better/.
Greets, Ertugrul
-- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Arnaud Bailly wrote:
Hello Cafe,
I will be (re)presenting Haskell in a "Batlle Language" event Wednesday evening: A fun and interactive contest where various programming language champions try to attract as much followers as possible in 5 minutes.
Having successfully experimented the power of live coding in a recent Haskell introduction for the Paris Scala User Group, I would like to do the same but given the time frame I need a simpler example than the music synthesizer program.
So I would like to tap in the collective wisdom looking for some concise, eye-opening, mind-shaking and if possible fun example of what one can achieve in Haskell. Things that sprung to my mind are rather dull: prime factors, fibonacci numbers.
A morse code decoder, perhaps? http://apfelmus.nfshost.com/articles/fun-with-morse-code.html Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com
participants (11)
-
Albert Y. C. Lai
-
Arnaud Bailly
-
Ertugrul Söylemez
-
Heinrich Apfelmus
-
Ivan Lazar Miljenovic
-
Jason Dagit
-
Magnus Therning
-
Patrick Browne
-
Richard O'Keefe
-
roconnor@theorem.ca
-
Yves Parès