Hylograph.Flow
- Package
- purescript-hylograph-flow
- Repository
- afcondon/purescript-hylograph-flow
One shared "flow" value: things that hold a value (items) and things that
compute (steps), wired together, as in Build Systems a la Carte's store
and tasks. Domain detail rides in the item, step and wire
parameters and is never inspected here. A flow with nothing to say about
its wires has Unit there; one whose wires carry a quantity (a Sankey's
widths) has the quantity.
What is drawn is not in the value: project takes a Drawing. Run state
is not in the value: see Hylograph.Flow.Overlay. Grouping is not in the
value: see Hylograph.Flow.Grouping. Shapes of steps over collections
live one layer up, in Hylograph.Flow.Collection.
#StepId Source
data StepIdWhich step. StepId: a step of the source, by the name the source gave
it. GroupStep: the one step a closed group became under collapse.
They are different constructors, so no name a source can give a step is
the identity of a group, whatever the name's letters.
Constructors
Instances
#PortName Source
data PortNameWhich port of a step. PortName: a port of the source's own step.
MemberPort: a port of a closed group, which is a port of one of its
members seen from outside: the member and the member's port. The member
may itself be a closed group and its port a MemberPort, where a flow
already collapsed is collapsed again.
Constructors
Instances
#wireEnds Source
wireEnds :: WireId -> { from :: ElementKey, to :: ElementKey }The two elements a wire joins, in the direction it runs.
#mapPayloads Source
mapPayloads :: forall i i' s s' w w'. (i -> i') -> (s -> s') -> (w -> w') -> Flow i s w -> Flow i' s' w'#ElementKey Source
data ElementKeyAny element of a flow, for drawing and for overlays. A wire is keyed by its identity, never by what it carries.
Constructors
Instances
#Drawing Source
data DrawingWhich elements a picture draws as nodes. Every element not drawn is contracted: an edge runs between two drawn elements for each path of wires between them through undrawn ones.
Holders: items are nodes, each step becomes edges (a spreadsheet's columns, a Makefile's files).Steps: steps are nodes, each item becomes edges (a radio's blocks).Both: the bipartite graph, every wire an edge.Chosen: the caller says, element by element. Added beyond the three agreed cases, because two subjects (Makefile phony targets drawn among files; the rig chart's stores drawn among its processes) draw some of each kind, and none of the three reproduces them.
Constructors
#drawnBy Source
drawnBy :: Drawing -> ElementKey -> BooleanWhether a drawing draws an element as a node.
#Edge Source
type Edge wire = { from :: ElementKey, fromPort :: Maybe PortName, to :: ElementKey, toPort :: Maybe PortName, via :: Array ElementKey, wires :: NonEmptyArray (Wire wire) }via: the undrawn elements the edge passes through, from source to
target. fromPort: the port it leaves a drawn step by; toPort: the
port it enters a drawn step by. wires: the wires the edge stands for,
each with its identity and what it carries, from source to target. They
are a path: the first leaves from, the last enters to, and each one
between meets the next at an element of via. An edge is at least one
wire: exactly one where the edge is a wire (Both), two where it
crosses one undrawn element. A wire on several paths is in several
edges. (Hylograph.Flow.Laws states all of this as a function.)
#project Source
project :: forall i s w. Drawing -> Flow i s w -> Projection wNodes in array order, items before steps. Edges in the order of the wire that enters their target.
#layers Source
layers :: forall w. Projection w -> Map ElementKey IntLongest path from a node with no incoming edge, over the projection. Self-loops are ignored; nodes on a cycle get the layer they had when the cycle was met.
#leafMass Source
leafMass :: forall w. Projection w -> Map ElementKey (Set ElementKey)Per node, the set of nodes with no incoming edge that reach it (itself, for such a node).
#isolated Source
isolated :: forall w. Projection w -> Array ElementKeyNodes no edge touches, in node order.