Francesco, using existentials looks promising! I'll work on it.
Perhaps people owning hamsters is more easily represented with maps, at least in an economy in which every hamster has exactly one owner. Here is a nearly identical example that surely requires a graph:
data GraphNode = Person String | Hamster String
data GraphEdge = Owns -- people own hamsters
| Friend -- any two GraphNodes can be friends
If you used maps for this kind of information, you would have a lot of copies of the same thing. If you changed someone's name, you would have to search through each map to find every instance of it. In a graph, by contrast, you would just change it in the one place that it is represented. Moreover, with maps there's the risk of indicating someone owns a hamster that does not exist. You have to keep some kind of master record of which hamsters are available, and check each map against it. In a graph, a hamster that does not exist is not represented, and so cannot be linked to.
Bryan Richter wrote;
> Maybe this?
>
> data GraphNode = NodePerson Person | NodeHamster Hamster
That's what I was already doing! I feel validated.