
8 Jan
2009
8 Jan
'09
3:28 a.m.
Hi, I'd like to process some kind of graph data structure, say something like data DS = A [DS] | B DS DS | C. but I want to be able to discover any sharing. Thus, in b = B a a where a = A [C], if I want to malloc a similar data structure, I have to handle to the node representing B two times the same pointer (the one returned after allocating A [C]). To discover sharing, I thought it would be necessary to give unique name to node and then compare them while traversing the graph. I could give the name by hand but it would be cumbersome. But at least it would not require any monad for the bookkeeping of ungiven names. Is it possible to give those names automatically but outside any monad ? Thanks, Thu