How do you represent a graph in Haskell?
问题 It's easy enough to represent a tree or list in haskell using algebraic data types. But how would you go about typographically representing a graph? It seems that you need to have pointers. I'm guessing you could have something like type Nodetag = String type Neighbours = [Nodetag] data Node a = Node a Nodetag Neighbours And that would be workable. However it feels a bit decoupled; The links between different nodes in the structure don't really "feel" as solid as the links between the current