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

index b3ab5aa..adcf0cc 100644 (file)
@@ -127,7 +127,11 @@ certain useful guarantees.
 if there is a `map` function defined for that box type with the type given above. This
 has to obey the following Map Laws:
 
 if there is a `map` function defined for that box type with the type given above. This
 has to obey the following Map Laws:
 
-    TODO 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>.
+
 
 *   ***MapNable*** (in Haskelese, "Applicatives") A Mappable box type is *MapNable*
        if there are in addition `map2`, `mid`, and `mapply`.  (Given either
 
 *   ***MapNable*** (in Haskelese, "Applicatives") A Mappable box type is *MapNable*
        if there are in addition `map2`, `mid`, and `mapply`.  (Given either