explain mappable laws better
authorjim <jim@web>
Thu, 19 Mar 2015 22:47:08 +0000 (18:47 -0400)
committerLinux User <ikiwiki@localhost.members.linode.com>
Thu, 19 Mar 2015 22:47:08 +0000 (18:47 -0400)
topics/week7_introducing_monads.mdwn

index adcf0cc..8f32014 100644 (file)
@@ -130,7 +130,7 @@ has to obey the following Map Laws:
     <code>map (id : α -> α) = (id : <u>α</u> -> <u>α</u>)</code>  
     <code>map (g ○ f) = (map g) ○ (map f)</code>
 
-    Essentially these say that `map` is a homomorphism from `(α -> β, ○, id)` to <code>(<u>α</u> -> <u>β</u>, ○', id')</code>, where `○'` and `id'` are `○` and `id` restricted to arguments of type <code><u>_</u></code>.
+    Essentially these say that `map` is a homomorphism from `(α -> β, ○, id)` to <code>(<u>α</u> -> <u>β</u>, ○', id')</code>, where `○'` and `id'` are `○` and `id` restricted to arguments of type <code><u>_</u></code>. That might be hard to digest because it's so abstract. Think of the following concrete example: if you take a `α list` (that's our <code><u>α</u></code>), and apply `id` to each of its elements, that's the same as applying `id` to the list itself. That's the first law. And if you apply the composition of functions `g ○ f` to each of the list's elements, that's the same as first applying `f` to each of the elements, and then going through the elements of the resulting list and applying `g` to each of those elements. That's the second law. These laws obviously hold for our familiar notion of `map` in relation to lists.
 
 
 *   ***MapNable*** (in Haskelese, "Applicatives") A Mappable box type is *MapNable*