Label edges of `fgl` graph based on directives

Viewed 39

Currently, I have the following data type (call it a directive),

data type = Up (a -> Bool) | Down (a -> bool)

And given a list of directives, I would like to apply/add edge. For example,

([Up (\_ -> True)], "parent")

Should add edge (a, b, "parent"), where a and b are the last two nodes in the traversal based on directive.

Another example,

([Up (\_ -> True), Up (\a -> sex a == "male")], "grandfather")

My aim is to label edges relative to some rooted node. For example, an edge between parent node's and its parent is labelled grandparent so it is relative to some rooted node. I have attempted to use gfold which has an argument Context a b -> [Node] to determine which nodes to visit but could not understand it.

0 Answers
Related