[Haskell wikibook] Article ANN: Theseus and the zipper
David House
dmhouse at gmail.com
Mon Feb 19 17:26:23 EST 2007
On 19/02/07, apfelmus at quantentunnel.de <apfelmus at quantentunnel.de> wrote:
> Of course, comments, corrections and criticism are welcome!
The second section, then:
1) Formatting: IMO it'd look better if the formulae were left-aligned.
2) It's currently sitting a little oddly. I think the way to take this
is to write an 'Algebra on Datatypes' article which explains what 1,
0, +, * etc. mean in the concept of types and also show some
elementary results like distributivity of * over +, c.f. normal
algebra, and so on. We would also need to explain isomorphisms as
they're really important but we can't really assume them.
Then we link to that article as essential background reading before
tackling the zippers bit. We should also move the differentiation bit
to the Algebra on Datatypes article, which would enable the focus in
the zippers article to remain a bit more; at the moment there's
something of a discourse at the beginning of the second section.
Nearing the end of the AoD article we would link to the Zippers
article and say 'Check out a really cool development of this'.
3) The notion of a 'one-hole context' isn't fully explained; it's an
odd concept to begin with and we don't really develop it enough. We
should say something like 'Imagine a datastructure parameterised over
a type, like trees, lists etc.. If we were to remove one of the values
of this type from the structure and replace it with a placeholder
indicating we've just removed something, we obtain the one-hole
context for that removed object.', then back it up with examples,
like:
data ListHole a = LH [a] a [a]
data TreeHole a = ...
Then we launch into the discussion about the algebra, then we say
something like:
"Look! The zipper for an A is just the one-hole context plus an A! You
may have already spotted that from our examples of one-hole contexts
earlier. It also makes sense; the one-hole context is a structure
missing an A, so couple that with an A and you can get the original
structure back, but this one object is singled out, focussed. Sounds
like a zipper."
Let me know what you think of these ideas. I should also point out, as
Eric commented, that this is a really creative and different tutorial;
it's got its limitations but I think this could be another great
'Killer article' to add to our repertoire. Great work!
--
-David House, dmhouse at gmail.com
More information about the Wikibook
mailing list