transformers tweak
authorJim Pryor <profjim@jimpryor.net>
Mon, 13 Dec 2010 06:30:47 +0000 (01:30 -0500)
committerJim Pryor <profjim@jimpryor.net>
Mon, 13 Dec 2010 06:30:47 +0000 (01:30 -0500)
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
monad_transformers.mdwn

index 086a2ff..d387097 100644 (file)
@@ -347,13 +347,11 @@ We can use TreeT(Reader) to modify leaves:
 
        # let tree_reader = TR.distribute (fun i -> R.asks (fun e -> e i)) t1;;
        # TR.run tree_reader (fun i -> i+i);;
 
        # let tree_reader = TR.distribute (fun i -> R.asks (fun e -> e i)) t1;;
        # TR.run tree_reader (fun i -> i+i);;
-       (*
        - : int T.tree option =
        Some
         (T.Node
           (T.Node (T.Leaf 4, T.Leaf 6),
                T.Node (T.Leaf 10, T.Node (T.Leaf 14, T.Leaf 22))))
        - : int T.tree option =
        Some
         (T.Node
           (T.Node (T.Leaf 4, T.Leaf 6),
                T.Node (T.Leaf 10, T.Node (T.Leaf 14, T.Leaf 22))))
-       *)
 
 Here's a comparison of how distribute works for trees and how it works for lists:
 
 
 Here's a comparison of how distribute works for trees and how it works for lists:
 
@@ -383,14 +381,12 @@ We can use TreeT(State) to count leaves:
 
        # let tree_counter = TS.distribute (fun i -> S.(puts succ >> unit i)) t1 in
          TS.run tree_counter 0;;
 
        # let tree_counter = TS.distribute (fun i -> S.(puts succ >> unit i)) t1 in
          TS.run tree_counter 0;;
-       (*
        - : int T.tree option * S.store =
        (Some
          (T.Node
                (T.Node (T.Leaf 2, T.Leaf 3),
                 T.Node (T.Leaf 5, T.Node (T.Leaf 7, T.Leaf 11)))),
         5)
        - : int T.tree option * S.store =
        (Some
          (T.Node
                (T.Node (T.Leaf 2, T.Leaf 3),
                 T.Node (T.Leaf 5, T.Node (T.Leaf 7, T.Leaf 11)))),
         5)
-       *)
 
 or to annotate leaves:
 
 
 or to annotate leaves: