Later, we will talk more about controlling the order in which nodes are visited.
One more revealing example before getting down to business: replacing
Later, we will talk more about controlling the order in which nodes are visited.
One more revealing example before getting down to business: replacing
- let rec tree_monadize (f : 'a -> ('b, 'r) continuation) (t : 'a tree) : ('b tree, 'r) continuation =
+ let rec tree_monadize (f : 'a -> ('r,'b) continuation) (t : 'a tree) : ('r,'b tree) continuation =
match t with
| Leaf a -> continuation_bind (f a) (fun b -> continuation_unit (Leaf b))
| Node (l, r) -> continuation_bind (tree_monadize f l) (fun l' ->
match t with
| Leaf a -> continuation_bind (f a) (fun b -> continuation_unit (Leaf b))
| Node (l, r) -> continuation_bind (tree_monadize f l) (fun l' ->
It's not immediately obvious to us how to simulate the List monadization of the tree using this technique.
We could simulate the tree annotating example by setting the relevant
It's not immediately obvious to us how to simulate the List monadization of the tree using this technique.
We could simulate the tree annotating example by setting the relevant
Andre Filinsky has proposed that the continuation monad is
able to simulate any other monad (Google for "mother of all monads").
Andre Filinsky has proposed that the continuation monad is
able to simulate any other monad (Google for "mother of all monads").