| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Circuit.Diagram
Description
Generic, untyped string-diagram syntax.
This is the surface that renderers consume. It discards the Haskell types but keeps the layout structure: boxes, wires, bends, swaps, composition and tensor. Constructors live here independently of any particular semantic interpretation (polynomial lenses, matrices, etc.).
Documentation
Untyped drawing syntax for a string diagram.
This is what a renderer consumes. It discards the Haskell types but keeps the layout structure: boxes, wires, bends, swaps, composition and tensor.
Constructors
| SWire | Straight identity wire. |
| SBox String Int Int | Box with a label, a number of input ports and a number of output ports. |
| SSpider Int Int | Spider node with an input arity and an output arity (hypergraph junction: all its ports share one wire class). |
| SPrismBox | Prism box. |
| SBeside SDiagram SDiagram | Two diagrams side by side (tensor product). |
| SThenD SDiagram SDiagram | Two diagrams chained (composition). |
| SBend | Cup (counit): bends two wires back to the unit. |
| SBend' | Cap (unit): introduces two wires from the unit. |
| STurn SDiagram | Dual (rotate 180°). |
| SUnitL | Left unitor |
| SUnitL' | Inverse left unitor |
| SUnitR | Right unitor |
| SUnitR' | Inverse right unitor |
| SAssoc | Associator |
| SAssoc' | Inverse associator |
| SSwap | Symmetric braiding |
| STrace SDiagram | Trace: hide the last input/output pair as a feedback loop. A value |