Search code examples
functional-programmingsignalselmtime-travel

Elm: Generate Signal Graph for Elm program


I watched Laszlo's talk about time travel debugging in Elm (https://youtu.be/lK0vph1zR8s) and in his presentation he used the signal graph to visualize the effects of the time traveling. Now you can use the debugger with the elm-reactor, but I see no option to turn on the signal graph visualization. There was a discussion about this: https://groups.google.com/forum/#!msg/elm-discuss/24jTnaChA6g/9WipFs9PBwAJ

Are there any news about it?

In general, is there a possibility to generate the signal graph for an Elm program?

Thanks in advance.


Solution

  • The talk by Laszlo is already quite old, considering the rapid development of the Elm language. At that talk he showed a hacked up prototype based on a slightly adapted Elm runtime. The time traveling debugger (elm-reactor) was the tool that resulted from expanding on his work.

    The discussion you link to on the mailing list is the last one that I'm aware of about adding signal graphs to the Reactor.

    At the time (IIRC), Laszlo generated the graph using an adapted runtime implementation of Signals. Every Signal node in the graph had a string identifying the kind of node. By running the Elm program, the graph was set up. Then the graph was traversed and recorded in a simple data structure. The string was used to identify the kind of each node. This was then sent to the server, which employed graphviz to render the graph.
    So it's certainly possible to generate the graph like that. Although one observation was that it lost some of the more high-level information available in your program because some Signal functions are defined in terms of others.