transformers tweak
authorJim Pryor <profjim@jimpryor.net>
Mon, 13 Dec 2010 04:35:57 +0000 (23:35 -0500)
committerJim Pryor <profjim@jimpryor.net>
Mon, 13 Dec 2010 04:35:57 +0000 (23:35 -0500)
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
monad_transformers.mdwn

index a1e6d45..3b5312c 100644 (file)
@@ -252,7 +252,7 @@ then `list_bind u f` would be `concat [[]; [2]; [2; 4]; [2; 4; 8]]`, that is `[2
                                 |  |
                                 4  8
 
                                 |  |
                                 4  8
 
-Except, as we mentioned, our implementation of the Tree monad incorporates an Optionish layer too. So `f' 2` should be not `Leaf 2` but `Some (Leaf 2)`. What if `f'` also mapped `1` to `None` and `4` to `Some (Node (Leaf 2, Leaf 4))`. Then binding the tree `Node (Leaf 1, Node (Leaf 2, Leaf 4))` to `f'` would delete thr branch corresponding to the original `Leaf 1`, and would splice in the results for `f' 2` and `f' 4`, yielding:
+Except, as we mentioned, our implementation of the Tree monad incorporates an Optionish layer too. So `f' 2` should be not `Leaf 2` but `Some (Leaf 2)`. What if `f'` also mapped `1` to `None` and `4` to `Some (Node (Leaf 2, Leaf 4))`. Then binding the tree `Node (Leaf 1, Node (Leaf 2, Leaf 4))` (really the tree itself needs to be wrapped in a `Some`, too, but let me neglect that) to `f'` would delete the branch corresponding to the original `Leaf 1`, and would splice in the results for `f' 2` and `f' 4`, yielding:
 
         .                        
        _|__  >>=  f' ~~>         
 
         .                        
        _|__  >>=  f' ~~>