shamansir / genui / GenUI.ToGraph

Converting to Graph.


type alias Node a =
GenUI.Property a

Node is just G.Property


type alias Edge a =
{ parent : GenUI.Property a
, child : GenUI.Property a 
}

Edge holds both the parent and its child

toGraph : a -> GenUI a -> Graph (Node a) (Edge a)

Convert GenUI structure to Graph where nodes represent controls and folders and edges connect inner controls to their folders.

IDs for nodes are given using GenUI.withIndices (incremental and not bound to the deepness level). The root node has the ID of -1.

The root node is created to hold properties that are on the top level. The first argument is the value for this root node.

nodeToString : Node a -> Maybe String

The short representation of the property.

edgeToString : Edge a -> Maybe String

The short representation of the edge.