[Haskell wikibook] Re: More on topic reorganization

Heinrich Apfelmus apfelmus at quantentunnel.de
Mon May 17 10:27:16 EDT 2010


Daniel Mlot wrote:
> 
> Just to mention I have added some ideas for "Elementary" and
> "Intermediate" in the list of topics as well. Alongside some other
> issues, there are three things for which I can't see an obvious solution.
> 
> * Can we provide meaningful examples of pattern matching on lists
> without making use of recursive algorithms? At first I the possibility
> of moving the "Recursion" chapter to Basics, just after "Tuples and
> Lists", and use the context to introduce x:xs - but that would kind of
> defeat the pedagogical proposal of emphasizing function composition
> before considering in more depth the "inner workings" of functions. The
> most adequate alternative, then, would be to mention pattern matching on
> lists only *very* briefly, I guess...

Yep, it should be mentioned only briefly for lists. However, I am now
convinced that pattern matching should be introduced in Haskell Basics.
Fortunately, boolean functions make good examples for that.

> (A related observation. Apfelmus' proposal includes a "Working with
> lists" module in Basics which would be dedicated entirely to list
> comprehensions. Initially I wondered whether discussing map and filter
> in that context would be an improvement. Doing so, however, would
> immediately make it necessary to push, at the very least, "Recursion" to
> Basics as a prerequisite. Having both map, filter and recursion in
> Basics would likely make things too clunky. I also wonder if this
> decision on how far to delve into lists in Basics would have any
> significant effects in the "Building a Vocabulary" module.)

It's possible to introduce  map  and  filter  as "black-box" functions
and discuss them without recursion. :) In a sense, that's what list
comprehensions already do.

> * I am slightly bothered by having "More on Functions" and "Control
> Structures" only at the end of "Elementary Haskell". "Control
> Structures" should probably be after "Pattern Matching" anyway, even
> more so now that we're presenting case structures for the first time. As
> for "More on Functions", I feel moving it to an earlier point (just
> after "Recursion", maybe) could improve reading flow (IMO increased
> alternation of "syntactic" and "conceptual" modules makes for a less
> tiring read). Furthermore, it would allow us to make occasional use of
> lambdas, prefixed operators and similar things in the following chapters
> without worrying with pre-requisites (and, at the same time, helping
> readers to, through small doses, get used to the syntactic variants).

Alternating syntactic and conceptual modules is a good idea.

I'm still very hazy on what exactly the "Elementary Haskell" Section
should cover. Hopefully, this will become clear after fleshing out the
"Haskell Basics".

But it's clear that "Recursion" should be at the very top, or even at
the end of Haskell Basics. I agree that it's a good idea to put "More on
Functions" next.

Not sure whether "Pattern matching" should remain intact. The concept
itself should be introduced in the "Haskell Basics" already, but I do
see the need for a more comprehensive reference, also because it's good
for modularity: the reader may have been introduced to pattern matching
elsewhere and is now looking for more a comprehensive account of the
syntax. There is no harm in repeated explanation, even. In any case, we
should link to the corresponding introductory chapter in Haskell Basics.


Regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com



More information about the Wikibook mailing list