[Haskell-cafe] Coding katas/dojos and functional programming introduction

Mike Meyer mwm at mired.org
Wed Apr 15 19:15:30 UTC 2015


On Wed, Apr 15, 2015 at 1:34 AM, Gautier DI FOLCO <gautier.difolco at gmail.com>
wrote:
> Some days ago I have participated to a coding dojo* which aimed to be an
introduction to functional programming. I have also facilitate 3 of events
like this and do several talks on this subject. But I'm kinda disappointed
because each time there is a common pattern:
> 1. Unveil the problem which will be treated
> 2. Let the attendees solve it
> 3. Show the FP-ish solution (generally a bunch of map/fold)
> I think it's frustrating for the attendees (because they don't try to
solve it) and gives a false illusion of knowledge.
> I don't consider myself as a "FP guru" or anything but for me FP is a
matter of types and expressions, so when someone illustrate FP via
map/fold, it's kind of irritating.
> Ironically, the best workshop I have done was on functional
generalization (you begin by two hard coded functions, sum and product, and
you extract Foldable and Monoid), but again, it's not satisfying.
> We can do better, we should do better.
> Have you got any feedback/subjet ideas/examples on how to introduce
"real" FP to beginners in a short amount of time (like 1-3 hours)?

Well, functional programming is very much like an elephant. I started
with it doing Scheme, so while I appreciate what the HM type system
brings to the table, to me it's not what functional programming is about.

To me, functional programming is about thinking about functions as
data, and designing them so you can compose and combine them like you
would data, as opposed to simply being tools for encapsulating code.

As such, maps and folds are simple, easy-to-understand higher order
functions that you can plug other functions into. But such discussions
tend to highlight map/fold, not how you build the functions that get
plugged into them.

To me, a better example would be one of the combinator-based parsing
libraries. Say Text.XML.Cursor, as in the School of Haskell tutorial
at
https://www.fpcomplete.com/school/starting-with-haskell/libraries-and-frameworks/text-manipulation/tagsoup
.

   <mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150415/d7538cf1/attachment.html>


More information about the Haskell-Cafe mailing list