Hylograph.Flow.Laws
- Package
- purescript-hylograph-flow
- Repository
- afcondon/purescript-hylograph-flow
What must hold of any projection of any flow, as a function that returns what does not. Here, and not in a test directory, so that every adapter's tests can hold the projections of its own real flows to it.
#projectionFaults Source
projectionFaults :: forall i s w. Drawing -> Flow i s w -> Array StringEvery fault in the projection of a flow under a drawing, in words; none is the law.
- every wire of every edge is a wire of the flow;
- an edge's wires are a path: the first leaves
from, the last entersto, each one between meets the next at the element ofviain that place, both ends are drawn and nothing inviais;fromPortandtoPortare the ports of the first and last wire where those ends are steps; - the edges are exactly the paths of wires from a drawn element to a
drawn element through undrawn ones (
paths), each path one edge.
So a wire between two drawn elements is one edge, alone in it; a wire with an undrawn end is in one edge for each such path through it, which may be several (a step with two inputs, contracted, puts its output wire in two edges) or none (nothing drawn is reached that way). Those two are restated as checks of their own, though they follow.
#paths Source
paths :: forall i s w. Drawing -> Flow i s w -> Array (NonEmptyArray WireId)Every path of wires from a drawn element to a drawn element through
undrawn ones, no undrawn element twice on a path. Found walking forwards
from each wire that leaves a drawn element, where project walks
backwards from each wire that enters one.