[{"name":"Cartesian","comment":" A module for cartesian structure\n\nThis is an experiment in organizing wiring diagrams\n\nWe're not implementing this paper exactly, but finding some inspiration:\n\nThe Cost of Compositionality: A High-Performance Implementation of String Diagram Composition\n\n<https://arxiv.org/abs/2105.09257>\n\n\n## Types\n\n@docs C, Interface\n\n\n## Usage\n\n@docs before, aside, init, initWith, unit, group, interface, wrap\n\n","unions":[],"aliases":[{"name":"C","comment":" The type of a cartesian structure\n\nThis is not your typical category theory monoidal thing, as we store a recursive structure\n\n","args":["a"],"type":"Internal.Cartesian.C a"},{"name":"Interface","comment":" The Interface type describes the Arity of the cartesian system structure\n","args":[],"type":"Internal.Cartesian.Interface.Interface"}],"values":[{"name":"aside","comment":" Put two structures aside each other\n\nThe structures will be independent\n\nNote the order of arguments are flipped to support this syntax:\n\n    a |> aside b\n\nThis will put `a` 'first'\n\n","type":"Cartesian.C a -> Cartesian.C a -> Cartesian.C a"},{"name":"before","comment":" Put one structure before another\n\nThe structures will be dependent and must match in the interface\n\nNote the order of arguments are flipped to support this syntax:\n\n    a |> before b\n\nThis will put `a` 'first'\n\n","type":"Cartesian.C a -> Cartesian.C a -> Cartesian.C a"},{"name":"group","comment":" Group a structure\n\nThis may be used to group substructures\n\n","type":"Cartesian.C a -> Cartesian.C a"},{"name":"init","comment":" Initialize a simple 1->1 arity morphism with label 'a'\n","type":"a -> Cartesian.C a"},{"name":"initWith","comment":" Initialize a morphism with a given interface and label\n","type":"Basics.Int -> Basics.Int -> a -> Cartesian.C a"},{"name":"interface","comment":" Extract the outermost interface of the structure\n","type":"Cartesian.C a -> Cartesian.Interface"},{"name":"unit","comment":" The unit value\n\nThis is possibly not needed, but we'll start off using it.\n\nThis may disappear later.\n\n","type":"Cartesian.C a"},{"name":"wrap","comment":" Wrap a part of the structure with a label a\n","type":"a -> Cartesian.C a -> Cartesian.C a"}],"binops":[]},{"name":"Cartesian.Layout","comment":" Layout a cartesian structure\n\n\n## Usage\n\n@docs toLayout, toLayoutWithConfig\n\n","unions":[],"aliases":[],"values":[{"name":"toLayout","comment":" Layout a cartesian structure\n\nThis is unfinished, and won't do anything interesting yet.\n\n","type":"Internal.Cartesian.C a -> Internal.WiringDiagram.Layout.Layout a"},{"name":"toLayoutWithConfig","comment":" Layout with some configuration\n\nThis is unfinished, and won't do anything interesting yet.\n\n","type":"Diagram.Layout.Config.Config a -> Internal.Cartesian.C a -> Internal.WiringDiagram.Layout.Layout a"}],"binops":[]},{"name":"Diagram.Bound","comment":" Represent the horizontal and vertical ( possibly empty) extents of a two dimensional area.\n\n@docs Bound, init, empty\n\n","unions":[],"aliases":[{"name":"Bound","comment":" The Bound type\n","args":[],"type":"Internal.Bound.Bound"}],"values":[{"name":"empty","comment":" Initialize an empty Bound\n","type":"Diagram.Bound.Bound"},{"name":"init","comment":" Initialize a Bound from an Extent\n","type":"Internal.Extent.Extent -> Diagram.Bound.Bound"}],"binops":[]},{"name":"Diagram.Extent","comment":" Represent the horizontal and vertical extents of a two dimensinal area (also called bounding-box).\n\n@docs Extent, init\n\n","unions":[],"aliases":[{"name":"Extent","comment":" Represent the horizontal and vertical extents of a two dimensinal area\n","args":[],"type":"Internal.Extent.Extent"}],"values":[{"name":"init","comment":" Initialize an Extent from two corners, lo and hi\n","type":"Internal.Vec2.Vec2 -> Internal.Vec2.Vec2 -> Diagram.Extent.Extent"}],"binops":[]},{"name":"Diagram.Layout.Config","comment":" Configuration for Layouts\n\n@docs Config, default, setLeafExtent, setSpacing\n\n","unions":[],"aliases":[{"name":"Config","comment":" The Config type\n","args":["a"],"type":"Internal.Layout.Config.Config a"}],"values":[{"name":"default","comment":" A default Config\n","type":"Diagram.Layout.Config.Config a"},{"name":"setLeafExtent","comment":" Configure a function to compute the extent of a leaf node of a diagram from a value of type 'a'\n","type":"(a -> Internal.Bound.Bound) -> Diagram.Layout.Config.Config a -> Diagram.Layout.Config.Config a"},{"name":"setSpacing","comment":" Configure the spacing between nodes in the diagram\n","type":"Internal.Vec2.Vec2 -> Diagram.Layout.Config.Config a -> Diagram.Layout.Config.Config a"}],"binops":[]},{"name":"Diagram.Vec2","comment":" A simple Vec2 type for geometry\n\n@docs Vec2, init, translate\n\n","unions":[],"aliases":[{"name":"Vec2","comment":" A simple Vec2 type\n","args":[],"type":"Internal.Vec2.Vec2"}],"values":[{"name":"init","comment":" Initialize a Vec2 from two floats\n","type":"Basics.Float -> Basics.Float -> Diagram.Vec2.Vec2"},{"name":"translate","comment":" Translate one vector by another (add)\n","type":"Diagram.Vec2.Vec2 -> Diagram.Vec2.Vec2 -> Diagram.Vec2.Vec2"}],"binops":[]},{"name":"WiringDiagram","comment":" Wiring diagrams\n\n\n# Inspiration\n\n<https://arxiv.org/pdf/2101.12046.pdf>\n\n\n# Diagram type\n\n@docs Diagram\n\n\n# Simple use\n\nSee ['WiringDiagram.Simple'](@WiringDiagram.Simple)\n\n@docs init\n\n\n# Custom use\n\n@docs initLabeled, diagram\n\n\n# Diagram helpers\n\n@docs source, sink, relation, inSequence, inParallel, setLabel\n\n\n# Wrapping\n\nParts of a Diagram can be wrapped and given a label of its own (with setLabel)\n\n@docs initWrap\n\n","unions":[],"aliases":[{"name":"Diagram","comment":" Represent an abstract wire-diagram.\n\nThink of boxes connected with ports, that can be inside other boxes (which connect outside)\n(TODO illustration)\n\n","args":["a"],"type":"Internal.WiringDiagram.Diagram a"}],"values":[{"name":"diagram","comment":" Wrap a diagram, exposing the free in and out ports\n","type":"{ a | label : Maybe.Maybe b, inner : List.List (WiringDiagram.Diagram b) } -> WiringDiagram.Diagram b"},{"name":"inParallel","comment":" Put diagrams in parallel.\n\nNo connections will be made.\n\n(We probably need to relabel ports here...)\n\n","type":"List.List (WiringDiagram.Diagram a) -> WiringDiagram.Diagram a"},{"name":"inSequence","comment":" Connect diagrams in a chain\n","type":"List.List (WiringDiagram.Diagram a) -> WiringDiagram.Diagram a"},{"name":"init","comment":" Initialize an empty Diagram. The idea is a box with no label.\n\nThe box is abstract and will be given geometry using [the Layout module](@Layout)\n\nUse modifiers like `setInPorts` to configure further\n\n","type":"WiringDiagram.Diagram a"},{"name":"initLabeled","comment":" Initialize an empty Diagram with a label of a chosen type\n\nAll diagrams you intend to combine needs to have the same label type\n\n","type":"Maybe.Maybe a -> WiringDiagram.Diagram a"},{"name":"initWrap","comment":" Wrap a diagram, exposing the free in and out ports\n","type":"WiringDiagram.Diagram a -> WiringDiagram.Diagram a"},{"name":"relation","comment":" Make a relation with label a and a number of inPorts and outPorts\n","type":"a -> Basics.Int -> Basics.Int -> WiringDiagram.Diagram a"},{"name":"setLabel","comment":" Assign a label to a Diagram\n\n    setLabel (Just \"node\") <| diagram --\n\n","type":"Maybe.Maybe a -> WiringDiagram.Diagram a -> WiringDiagram.Diagram a"},{"name":"sink","comment":" Make a sink with label a and a number of inPorts\n","type":"a -> Basics.Int -> WiringDiagram.Diagram a"},{"name":"source","comment":" Make a source with label a and a number of outPorts\n","type":"a -> Basics.Int -> WiringDiagram.Diagram a"}],"binops":[]},{"name":"WiringDiagram.Examples","comment":" Some example diagrams\n\n@docs sampleDiagrams, a, b, c, a2, b2, c2, twoLanes\n\n","unions":[],"aliases":[],"values":[{"name":"a","comment":" A simple source labeled 'a'\n\nIt has one output port.\n\n","type":"WiringDiagram.Examples.Diagram"},{"name":"a2","comment":" A simple source labeled 'a2'\n\nIt has two output ports\n\n","type":"WiringDiagram.Examples.Diagram"},{"name":"b","comment":" A simple relation labeled 'b'\n\nIt has one input and one output port\n\n","type":"WiringDiagram.Examples.Diagram"},{"name":"b2","comment":" A simple relation labeled 'b2'\n\nIt has two input and output ports\n\n","type":"WiringDiagram.Examples.Diagram"},{"name":"c","comment":" A simple sink labeled 'c'\n\nIt has one input port\n\n","type":"WiringDiagram.Examples.Diagram"},{"name":"c2","comment":" A simple sink labeled 'c2'\n\nIt has two input ports\n\n","type":"WiringDiagram.Examples.Diagram"},{"name":"sampleDiagrams","comment":" A list of some diagrams\n\n    sampleDiagrams : List Diagram\n    sampleDiagrams =\n        [ inSequence [ a, b, c ]\n        , inSequence [ wrap a, wrap b ]\n        , inSequence [ wrap a, wrap (inParallel [ b, c |> offsetPorts 1 ]) ]\n        , wrap_a\n        , inSequence\n            [ wrap (source \"a\" 2)\n            , sink \"b\" 2\n            ]\n        , wrap_axb_c\n        , inSequence [ a, b ]\n        , inSequence [ source \"a3\" 3, sink \"b2\" 2 ]\n        ]\n\n","type":"List.List WiringDiagram.Examples.Diagram"},{"name":"twoLanes","comment":" Two sequenced diagrams in parallel\n\n    inParallel\n        [ inSequence [ a, c ]\n        , inSequence [ source \"d\" 1, sink \"e\" 1 ]\n        ]\n\n","type":"WiringDiagram.Examples.Diagram"}],"binops":[]},{"name":"WiringDiagram.Layout","comment":" Layout of WiringDiagram values\n\nTypically a Layout can be converted to SVG for display\n\n\n# Definition\n\n@docs Layout, empty\n\n\n# Simple Layout of a Diagram\n\n@docs layoutDiagram\n\n\n# Customized Layout of a Diagram\n\n@docs layoutDiagramWithConfig\n\n\n# Misc\n\n@docs Polarity, portPositionsOfBox, incoming, outgoing\n\n","unions":[],"aliases":[{"name":"Layout","comment":" The Layout type keeps information about the layout of a Wiring diagram.\n","args":["a"],"type":"Internal.WiringDiagram.Layout.Layout a"},{"name":"Polarity","comment":" Polarity of a Port. Is the port going In or Out of something\n","args":[],"type":"Internal.Extent.Polarity"}],"values":[{"name":"empty","comment":" An empty Layout\n","type":"WiringDiagram.Layout.Layout a"},{"name":"incoming","comment":" Polarity of a Port that is incoming\n","type":"WiringDiagram.Layout.Polarity"},{"name":"layoutDiagram","comment":" Layout a Diagram with default configuration\n","type":"WiringDiagram.Diagram a -> WiringDiagram.Layout.Layout a"},{"name":"layoutDiagramWithConfig","comment":" Layout a Diagram with custom configuration\n","type":"Diagram.Layout.Config.Config a -> WiringDiagram.Diagram a -> WiringDiagram.Layout.Layout a"},{"name":"outgoing","comment":" Polarity of a Port that is outgoing\n","type":"WiringDiagram.Layout.Polarity"},{"name":"portPositionsOfBox","comment":" List the port positions of a Box, given a Polarity (In,Out)\n","type":"WiringDiagram.Layout.Polarity -> WiringDiagram.Layout.Box.Box a -> List.List ( Basics.Int, WiringDiagram.Layout.Box.Pos )"}],"binops":[]},{"name":"WiringDiagram.Svg","comment":" Convert a Layout of a WireDiagram to SVG\n\n@docs view, Viewport, simpleDiagramToSvg, simpleLayoutToSvg, layoutToSvg, diagramToSvg\n\n\n## Viewport defaults\n\n@docs smallViewport, mediumViewport, wideViewport, largeViewport\n\n\n# Customization\n\n@docs layoutToSvgWithConfig\n\n","unions":[],"aliases":[{"name":"Viewport","comment":" Placement and dimensions of a Viewport to render SVG inside\n","args":[],"type":"{ width : Basics.Float, height : Basics.Float, xMin : Basics.Float, yMin : Basics.Float }"}],"values":[{"name":"diagramToSvg","comment":" Shortcut render a Diagram (via Layout) to Svg\n","type":"WiringDiagram.Diagram a -> Svg.Svg msg"},{"name":"largeViewport","comment":" A larger sized viewport (1024x768)\n","type":"{ width : number, height : number, xMin : number, yMin : number }"},{"name":"layoutToSvg","comment":" Render a Layout to Svg\n","type":"Internal.WiringDiagram.Layout.Layout b -> Svg.Svg msg"},{"name":"layoutToSvgWithConfig","comment":" Render a Layout to Svg with configurable labeling\n","type":"WiringDiagram.Svg.Config.Config a -> Internal.WiringDiagram.Layout.Layout a -> Svg.Svg msg"},{"name":"mediumViewport","comment":" A medium sized viewport (640x480)\n","type":"{ width : number, height : number, xMin : number, yMin : number }"},{"name":"simpleDiagramToSvg","comment":" Shortcut render a Diagram with String labels (via Layout) to Svg\n","type":"WiringDiagram.Diagram String.String -> Svg.Svg msg"},{"name":"simpleLayoutToSvg","comment":" Render a (Layout String) to Svg\n","type":"Internal.WiringDiagram.Layout.Layout String.String -> Svg.Svg msg"},{"name":"smallViewport","comment":" A small viewport of 200x200\n","type":"{ width : number, height : number, xMin : number, yMin : number }"},{"name":"view","comment":" Render a list of Svg items in a viewport to Html\n","type":"WiringDiagram.Svg.Viewport -> List.List (Svg.Svg msg) -> Html.Html msg"},{"name":"wideViewport","comment":" A wide but low viewport of 1200x150\n","type":"{ width : number, height : number, xMin : number, yMin : number }"}],"binops":[]},{"name":"WiringDiagram.Svg.Config","comment":" Configure how to convert Layout Labels to Strings for Svg output\n\n@docs Config, forStringLabels, initWithLabelToString, withLabelToString\n\n\n# Applying the config (You probably won't need to use this, it will be used by `Svg.layoutToSvgWithConfig`)\n\n@docs applyToLabelString\n\n","unions":[{"name":"Config","comment":" Preliminary way to control how labels turn into String for SVG\n","args":["a"],"cases":[]}],"aliases":[],"values":[{"name":"applyToLabelString","comment":" Apply the toLabelString function of the config to a value of type a\n","type":"WiringDiagram.Svg.Config.Config a -> a -> String.String"},{"name":"forStringLabels","comment":" Simple starting config when labels are already String\n","type":"WiringDiagram.Svg.Config.Config String.String"},{"name":"initWithLabelToString","comment":" Init needs a labelToString function\n","type":"(a -> String.String) -> WiringDiagram.Svg.Config.Config a"},{"name":"withLabelToString","comment":" Simple starting config when labels are already String\n","type":"(a -> String.String) -> WiringDiagram.Svg.Config.Config a -> WiringDiagram.Svg.Config.Config a"}],"binops":[]}]