ivan-m / graphviz

Haskell bindings to the Graphviz toolkit
Other
64 stars 24 forks source link

FEATURE REQUEST: multiple from/to nodes in monadic representation #4

Closed haroldcarr closed 8 years ago

haroldcarr commented 8 years ago

FEATURE REQUEST:

Using functions:

(-->*) :: n -> [n] -> Dot n
(*-->) :: [n] -> n -> Dot n

then instead of writing

"a" --> "b"
"a" --> "c"
...
"a" --> "z"

one could write

"a" -->* ["b","c",..."z"]

and vice-versa.

Here is a version of -->* that works (not optimal since empty list crashes):

(-->*)        :: n -> [n] -> Dot n
f -->*   [t]  = f --> t
f -->* (t:ts) = f --> t >> f -->* ts
ivan-m commented 8 years ago

Hmmmm.... I think a better way would be to have the edge function take either a single node or a list of nodes, and then so could --> and <->. Let me think about this.