I'm porting an ML program to Haskell, but am having difficulty with
particular data structure: a tree where each node has references to the
children as well as the parent...
data Tree a
= TreeRoot { stuff :: a
, children :: [Tree]
}
| TreeNode { stuff :: a
, parent :: Tree
, children :: [Tree]
}
But because of these bidirectional links, every time I add a node I must
reconstructing the entire tree. There is also the add coding complexity
of threading the tree through various functions to simulate state.
What are my [monadic] options?
-Tom
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe