how to implement doubly linked lists
问题 Is it possible to have a doubly linked list in Haskell, and what's the ideal solution to implementing them? I'm implementing a scene graph where every widget has a parent as well as a child, and it's beneficial to look both up and down the graph. 回答1: It isn't really practical to have a doubly linked list in Haskell, because you have to construct it all at once. For example, imagine that you have a list [1, 2, 3, 4, 5] that you want to make doubly linked. Now, let's imagine how the list is