Question

Haskell Arrows are commonly explained as expressing a directed acyclic graph (DAG) of computations. I'm looking for tools or library code that would use this relationship in aid of programming with Arrows.

From Arrow to graph, a tool could help visualize Arrow code. Since the code corresponds to a DAG of computations, a visual representation showing computational nodes and output-to-input edges is natural. A tool could create a graph to be viewed and manipulated with standard graph tools.

Is there Arrow transformer that augments an arbitrary compuatational Arrow class, capturing the structure provided by >>> and *** operations, and making it possible to inspect the computation as a graph of elementary Arrow operations?

From graph to Arrow, suppose there is a DAG whose nodes are Arrow operations. Is there a tool that would construct from this an Arrow which computes the entire DAG?

I've Googled much of what's written about Haskell Arrows without finding such visualization tools. Did I miss something? Perhaps there is not as natural a fit as I expect.

Was it helpful?

Solution

A good starting point is to specify your arrow graph using what is known as a "Free Arrow". You can find one implementation of free Arrows in this Stack Overflow answer. Think of this as a syntactic representation of your Arrow graph.

The nice thing about free Arrows is that they preserve the structure of the graph, which you can then display as a diagram. After displaying the graph of connections you can then use an interpreter to transform the free Arrow to the desired Arrow. One nice property that free Arrows have is that such an interpreter must be unique (up to isomorphism) by definition (that's one of the properties that makes it "free").

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top