I am working on a library for subdivision surfaces. In order to represent the mesh topology I'm using a kind of split-vertex lath data structure (see the diagram on the left side).

During the construction of a mesh, that also can be seen as a graph, it create nodes that should point to another ones that don't exist yet (see diagram on the right side - dashed arrow represent future links). The classical solution is to create a node with an empty pointer and then update it when the other one is created. Since I'm working on Haskell :) and I don't want to go to the dark side of the code (impurity) I'm wondering if it is possible to construct a mesh (graph) without update the data. I guess that CPS (Continuation Passing Style) could do the job but I can't figure out a way.
Is it just a dream?
UPDATE
Let me clarify my question a little bit. I am looking for a method to create nodes with direct links (pointers) and by direct link I mean no intermediate tables or maps. Just a plain data definition like that:
data Mesh = Edge Vertex Mesh Mesh Vertex | Ground
If I'm not wrong and if it is doable, CPS would allow an efficient creation (without node updates) and efficient transverse (without lookups on maps) of a graph. On the other hand the graph would become totally immutable i.e. a single change needs to be propagated through the whole graph e.g. changing the tail of a list.
Am I wrong? If no, how to do it?
Mesh; i.e. you want to tie the knot, but you will not be able to determine that, if you go somewhere and back, you actually got back instead of somewhere else in an infinite cyclic structure. In mathematics, graphs are defined over an arbitrary "carrier set" of vertices; I suggest doing the same for pure functional graphs. - luqui