From: Chris Barker Date: Sat, 27 Nov 2010 04:55:24 +0000 (-0500) Subject: edits X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=commitdiff_plain;h=1237fdc391dbd7d5dc380537211369b0878a2f1b;ds=inline edits --- diff --git a/zipper-lists-continuations.mdwn b/zipper-lists-continuations.mdwn index 142a2ba8..637f54d1 100644 --- a/zipper-lists-continuations.mdwn +++ b/zipper-lists-continuations.mdwn @@ -11,7 +11,7 @@ Rethinking the list monad ------------------------- To construct a monad, the key element is to settle on a type -constructor, and the monad naturally follows from that. I'll remind +constructor, and the monad naturally follows from that. We'll remind you of some examples of how monads follow from the type constructor in a moment. This will involve some review of familair material, but it's worth doing for two reasons: it will set up a pattern for the new @@ -125,10 +125,10 @@ So let's indulge ourselves in a completely useless digression and see if we can gain some insight into the details of the List monad. Let's choose type constructor that we can peer into, using some of the technology we built up so laboriously during the first half of the -course. I'm going to use type 3 lists, partly because I know they'll -give the result I want, but also because they're my favorite. These -were the lists that made lists look like Church numerals with extra -bits embdded in them: +course. We're going to use type 3 lists, partly because I know +they'll give the result I want, but also because they're the coolest. +These were the lists that made lists look like Church numerals with +extra bits embdded in them: empty list: fun f z -> z list with one element: fun f z -> f 1 z @@ -274,7 +274,7 @@ corresponding generalized quantifier: This function wraps up an individual in a fancy box. That is to say, we are in the presence of a monad. The type constructor, the unit and -the bind follow naturally. We've done this enough times that I won't +the bind follow naturally. We've done this enough times that we won't belabor the construction of the bind function, the derivation is similar to the List monad just given: @@ -290,7 +290,7 @@ constructor and the terms from the list monad derived above: l'_unit x = fun f -> f x l'_bind u f = fun k -> u (fun x -> f x k) -(I performed a sneaky but valid eta reduction in the unit term.) +(We performed a sneaky but valid eta reduction in the unit term.) The unit and the bind for the Montague continuation monad and the homemade List monad are the same terms! In other words, the behavior