Reading diagrams / Topic 2 of 42

An arrow is an import

The rule

A box is a package. An arrow from one box to another means the first package imports the second. In the source, an import is a from line. Router's file has one:

demos/structures/koa/router.bosatsu
package Yichus/Examples/Koa/Router

from Yichus/Examples/Koa/Context import Context, Middleware, tick

So the diagram draws an arrow from Router to Context.

Click a box to select it. The arrows that touch it turn thick and coloured; the others turn thin and grey. A thin grey arrow is still an import: the colour says only what you clicked. Where arrows cross behind a box, select a package and read its list of what it uses.

The selected package's detail sits under the picture. Uses lists the packages it imports, and Used by the packages that import it. The counts in brackets, such as 1 definition used, the number of uses printed on each box, and why some arrows are dashed come in a later topic; for now, every arrow, solid or dashed, is an import, and so is every package in the Uses list.

Above the picture are four controls. Draw as switches between boxes and arrows, used in these first topics, and tiles in rows, taught later. Group packages by and Show gather alike packages into groups, taught with the tiles. Fade dims every box the selected one is not built on; it starts on only for big programs. Leave them as they are until then.

The layers lens records every import between the program's own packages. That gives two rules.

A small copy of the Koa web framework: a server built from an application, a router and middleware.

Loading the layer diagram.

Loading the worked examples and practice.