| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Proarrow.Tools.Diagrams.Dot
Contents
Description
Synopsis
- type Port = String
- newtype Vec (as :: k) x = Vec {
- unVec :: [x]
- newtype Fin (as :: k) = Fin {}
- (!) :: forall {k} (as :: k) x. Vec as x -> Fin as -> x
- (+++) :: forall {k} (as :: [k]) x (bs :: [k]). Vec as x -> Vec bs x -> Vec (as ++ bs) x
- split :: forall {k} (as :: [k]) (bs :: [k]) x. IsList as => Vec (as ++ bs) x -> (Vec as x, Vec bs x)
- len :: forall {k} (as :: [k]). IsList as => Int
- ixs :: forall {k} (as :: [k]). IsList as => Vec as (Fin as)
- ixed :: forall {k} (as :: [k]) x. IsList as => Vec as x -> Vec as (Fin as, x)
- zipV3 :: forall {k} (as :: k) x y z. Vec as x -> Vec as y -> Vec as z -> Vec as (x, y, z)
- relax :: forall {k} (bs :: [k]) (as :: [k]). Fin as -> Fin (as ++ bs)
- shift :: forall {k} (as :: [k]) (bs :: [k]). IsList as => Fin bs -> Fin (as ++ bs)
- eitherF :: forall {k} (as :: [k]) (bs :: [k]) r. IsList as => (Fin as -> r) -> (Fin bs -> r) -> Fin (as ++ bs) -> r
- names :: forall (as :: [Symbol]). IsList as => Vec as String
- data SymRefl (a :: Symbol) (b :: Symbol) where
- SymRefl :: forall (a :: Symbol). KnownSymbol a => SymRefl a a
- data DOT = D [Symbol]
- data DotData (as :: k) (bs :: k1) = DotData {}
- data NodeKind
- data Dot (a :: DOT) (b :: DOT) where
- pointsPerWire :: forall (as :: [Symbol]) (xs :: [Symbol]) (ys :: [Symbol]). (IsList as, IsList xs, IsList ys) => (Fin xs -> (Int, String)) -> (Fin ys -> (Int, String)) -> String -> Dot ('D xs) ('D ys)
- wireAt :: forall {k} (as :: k). String -> Fin as -> (Int, String)
- eitherCopy :: forall (as :: [Symbol]). IsList as => String -> String -> Fin (as ++ as) -> (Int, String)
- feedback :: Port -> String -> Port -> (Port, String, Port)
- bend :: String -> Port -> Port
- swap2 :: forall (a :: Symbol) (b :: Symbol). (Ob a, Ob b) => Dot ('D '[a, b]) ('D '[b, a])
- swapNode :: forall (a :: Symbol) (b :: Symbol). (Ob a, Ob b) => Dot ('D '[a, b]) ('D '[b, a])
- node' :: forall (as :: [Symbol]) (bs :: [Symbol]). (IsList as, IsList bs) => NodeKind -> Vec as String -> Vec bs String -> String -> Dot ('D as) ('D bs)
- node :: forall (as :: [Symbol]) (bs :: [Symbol]). (IsList as, IsList bs) => String -> Dot ('D as) ('D bs)
- portedLabel :: Int -> Int -> String -> String
- nodeOrder :: [Either x Port] -> [(Port, String, Port)] -> Int -> [Int]
- nodeOf :: Port -> Int
- portOf :: Port -> String
- htmlEscape :: String -> String
- line :: forall (a :: Symbol). Ob a => Dot ('D '[a]) ('D '[a])
- getData :: forall (as :: [Symbol]) (bs :: [Symbol]). Dot ('D as) ('D bs) -> DotData as bs
- run :: forall (as :: [Symbol]) (bs :: [Symbol]). Dot ('D as) ('D bs) -> String
- onRank :: String -> String -> Int -> String
- header :: String
- statements :: forall (as :: [Symbol]) (bs :: [Symbol]). Dot ('D as) ('D bs) -> String
- unitAdj :: forall (l :: Symbol) (r :: Symbol). (Ob l, Ob r) => Dot ('D ('[] :: [Symbol])) ('D '[l, r])
- counitAdj :: forall (l :: Symbol) (r :: Symbol). (Ob l, Ob r) => Dot ('D '[r, l]) ('D ('[] :: [Symbol]))
Documentation
newtype Vec (as :: k) x Source Github #
Instances
| Functor (Vec as) Source Github # | |
| Foldable (Vec as) Source Github # | |
Defined in Proarrow.Tools.Diagrams.Dot Methods fold :: Monoid m => Vec as m -> m Github # foldMap :: Monoid m => (a -> m) -> Vec as a -> m Github # foldMap' :: Monoid m => (a -> m) -> Vec as a -> m Github # foldr :: (a -> b -> b) -> b -> Vec as a -> b Github # foldr' :: (a -> b -> b) -> b -> Vec as a -> b Github # foldl :: (b -> a -> b) -> b -> Vec as a -> b Github # foldl' :: (b -> a -> b) -> b -> Vec as a -> b Github # foldr1 :: (a -> a -> a) -> Vec as a -> a Github # foldl1 :: (a -> a -> a) -> Vec as a -> a Github # toList :: Vec as a -> [a] Github # null :: Vec as a -> Bool Github # length :: Vec as a -> Int Github # elem :: Eq a => a -> Vec as a -> Bool Github # maximum :: Ord a => Vec as a -> a Github # minimum :: Ord a => Vec as a -> a Github # | |
| Traversable (Vec as) Source Github # | |
Defined in Proarrow.Tools.Diagrams.Dot | |
| Show x => Show (Vec as x) Source Github # | |
| Eq x => Eq (Vec as x) Source Github # | |
(+++) :: forall {k} (as :: [k]) x (bs :: [k]). Vec as x -> Vec bs x -> Vec (as ++ bs) x Source Github #
split :: forall {k} (as :: [k]) (bs :: [k]) x. IsList as => Vec (as ++ bs) x -> (Vec as x, Vec bs x) Source Github #
zipV3 :: forall {k} (as :: k) x y z. Vec as x -> Vec as y -> Vec as z -> Vec as (x, y, z) Source Github #
eitherF :: forall {k} (as :: [k]) (bs :: [k]) r. IsList as => (Fin as -> r) -> (Fin bs -> r) -> Fin (as ++ bs) -> r Source Github #
data SymRefl (a :: Symbol) (b :: Symbol) where Source Github #
Constructors
| SymRefl :: forall (a :: Symbol). KnownSymbol a => SymRefl a a |
Instances
| Promonad SymRefl Source Github # | |
| Profunctor SymRefl Source Github # | |
Defined in Proarrow.Tools.Diagrams.Dot Methods dimap :: forall (c :: Symbol) (a :: Symbol) (b :: Symbol) (d :: Symbol). (c ~> a) -> (b ~> d) -> SymRefl a b -> SymRefl c d Source Github # lmap :: forall (c :: Symbol) (a :: Symbol) (b :: Symbol). (c ~> a) -> SymRefl a b -> SymRefl c b Source Github # rmap :: forall (b :: Symbol) (d :: Symbol) (a :: Symbol). (b ~> d) -> SymRefl a b -> SymRefl a d Source Github # (\\) :: forall (a :: Symbol) (b :: Symbol) r. ((Ob a, Ob b) => r) -> SymRefl a b -> r Source Github # | |
| Show (SymRefl a b) Source Github # | |
| Eq (SymRefl a b) Source Github # | |
Instances
| Monoidal DOT Source Github # | |||||||||
Defined in Proarrow.Tools.Diagrams.Dot Associated Types
Methods withOb2 :: forall (a :: DOT) (b :: DOT) r. (Ob a, Ob b) => (Ob (a ** b) => r) -> r Source Github # leftUnitor :: forall (a :: DOT). Ob a => ((Unit :: DOT) ** a) ~> a Source Github # leftUnitorInv :: forall (a :: DOT). Ob a => a ~> ((Unit :: DOT) ** a) Source Github # rightUnitor :: forall (a :: DOT). Ob a => (a ** (Unit :: DOT)) ~> a Source Github # rightUnitorInv :: forall (a :: DOT). Ob a => a ~> (a ** (Unit :: DOT)) Source Github # associator :: forall (a :: DOT) (b :: DOT) (c :: DOT). (Ob a, Ob b, Ob c) => ((a ** b) ** c) ~> (a ** (b ** c)) Source Github # associatorInv :: forall (a :: DOT) (b :: DOT) (c :: DOT). (Ob a, Ob b, Ob c) => (a ** (b ** c)) ~> ((a ** b) ** c) Source Github # | |||||||||
| SymMonoidal DOT Source Github # | |||||||||
| Closed DOT Source Github # | |||||||||
Defined in Proarrow.Tools.Diagrams.Dot Associated Types
Methods withObExp :: forall (a :: DOT) (b :: DOT) r. (Ob a, Ob b) => (Ob (a ~~> b) => r) -> r Source Github # curry :: forall (a :: DOT) (b :: DOT) (c :: DOT). (Ob a, Ob b) => ((a ** b) ~> c) -> a ~> (b ~~> c) Source Github # apply :: forall (a :: DOT) (b :: DOT). (Ob a, Ob b) => ((a ~~> b) ** a) ~> b Source Github # (^^^) :: forall (a :: DOT) (b :: DOT) (x :: DOT) (y :: DOT). (b ~> y) -> (x ~> a) -> (a ~~> b) ~> (x ~~> y) Source Github # | |||||||||
| CompactClosed DOT Source Github # | |||||||||
Defined in Proarrow.Tools.Diagrams.Dot Methods distribDual :: forall (a :: DOT) (b :: DOT). (Ob a, Ob b) => Dual (a ** b) ~> (Dual a ** Dual b) Source Github # dualUnit :: Dual (Unit :: DOT) ~> (Unit :: DOT) Source Github # dualityUnit :: forall (a :: DOT). Ob a => (Unit :: DOT) ~> (a ** Dual a) Source Github # dualityCounit :: forall (a :: DOT). Ob a => (Dual a ** a) ~> (Unit :: DOT) Source Github # | |||||||||
| CopyDiscard DOT Source Github # | |||||||||
| Hypergraph DOT Source Github # | The points make every object a special commutative Frobenius object, so a diagram's wires can be bent: each object is its own dual, with cups and caps drawn as a copy or merge point next to a unit or counit point. | ||||||||
Defined in Proarrow.Tools.Diagrams.Dot | |||||||||
| StarAutonomous DOT Source Github # | |||||||||
Defined in Proarrow.Tools.Diagrams.Dot Associated Types
Methods withObDual :: forall (a :: DOT) r. Ob a => (Ob (Dual a) => r) -> r Source Github # dual :: forall (a :: DOT) (b :: DOT). (a ~> b) -> Dual b ~> Dual a Source Github # dualInv :: forall (a :: DOT) (b :: DOT). (Ob a, Ob b) => (Dual a ~> Dual b) -> b ~> a Source Github # linDist :: forall (a :: DOT) (b :: DOT) (c :: DOT). (Ob a, Ob b, Ob c) => ((a ** b) ~> Dual c) -> a ~> Dual (b ** c) Source Github # linDistInv :: forall (a :: DOT) (b :: DOT) (c :: DOT). (Ob a, Ob b, Ob c) => (a ~> Dual (b ** c)) -> (a ** b) ~> Dual c Source Github # doubleNeg :: forall (a :: DOT). Ob a => Dual (Dual a) ~> a Source Github # doubleNegInv :: forall (a :: DOT). Ob a => a ~> Dual (Dual a) Source Github # | |||||||||
| CategoryOf DOT Source Github # | The category string diagrams are built in: an object | ||||||||
Defined in Proarrow.Tools.Diagrams.Dot | |||||||||
| Promonad Dot Source Github # | |||||||||
| MonoidalProfunctor Dot Source Github # | |||||||||
| Profunctor Dot Source Github # | |||||||||
Defined in Proarrow.Tools.Diagrams.Dot Methods dimap :: forall (c :: DOT) (a :: DOT) (b :: DOT) (d :: DOT). (c ~> a) -> (b ~> d) -> Dot a b -> Dot c d Source Github # lmap :: forall (c :: DOT) (a :: DOT) (b :: DOT). (c ~> a) -> Dot a b -> Dot c b Source Github # rmap :: forall (b :: DOT) (d :: DOT) (a :: DOT). (b ~> d) -> Dot a b -> Dot a d Source Github # (\\) :: forall (a :: DOT) (b :: DOT) r. ((Ob a, Ob b) => r) -> Dot a b -> r Source Github # | |||||||||
| Costrong (Tensor :: DOT -> (DOT, DOT) -> Type) Dot Source Github # | |||||||||
| Ob as => Frobenius ('D as :: DOT) Source Github # | The points are spiders: on each wire, merging and copying are the special commutative Frobenius structure. | ||||||||
Defined in Proarrow.Tools.Diagrams.Dot | |||||||||
| Ob as => CocommutativeComonoid ('D as :: DOT) Source Github # | |||||||||
Defined in Proarrow.Tools.Diagrams.Dot | |||||||||
| Ob as => CommutativeMonoid ('D as :: DOT) Source Github # | |||||||||
Defined in Proarrow.Tools.Diagrams.Dot | |||||||||
| Ob as => Comonoid ('D as :: DOT) Source Github # | |||||||||
| Ob as => Monoid ('D as :: DOT) Source Github # | |||||||||
| type Unit Source Github # | |||||||||
Defined in Proarrow.Tools.Diagrams.Dot | |||||||||
| type (~>) Source Github # | |||||||||
Defined in Proarrow.Tools.Diagrams.Dot | |||||||||
| type Dual (a :: DOT) Source Github # | |||||||||
Defined in Proarrow.Tools.Diagrams.Dot | |||||||||
| type Ob (a :: DOT) Source Github # | |||||||||
| type (ls :: DOT) ** (rs :: DOT) Source Github # | |||||||||
| type (a :: DOT) ~~> (b :: DOT) Source Github # | |||||||||
Defined in Proarrow.Tools.Diagrams.Dot | |||||||||
data DotData (as :: k) (bs :: k1) Source Github #
Constructors
| DotData | |
What a node means, as opposed to how it is drawn.
Constructors
| Spider | all its wires carry the same value: a (co)monoid point, a cup or a cap |
| Crossing | |
| Box | a generator, |
Instances
| Show NodeKind Source Github # | |
| Eq NodeKind Source Github # | |
| Ord NodeKind Source Github # | |
Defined in Proarrow.Tools.Diagrams.Dot | |
data Dot (a :: DOT) (b :: DOT) where Source Github #
Constructors
| Dot :: forall (as :: [Symbol]) (bs :: [Symbol]). (IsList as, IsList bs) => (Int -> (Int, DotData as bs)) -> Dot ('D as) ('D bs) |
Instances
| Promonad Dot Source Github # | |
| MonoidalProfunctor Dot Source Github # | |
| Profunctor Dot Source Github # | |
Defined in Proarrow.Tools.Diagrams.Dot Methods dimap :: forall (c :: DOT) (a :: DOT) (b :: DOT) (d :: DOT). (c ~> a) -> (b ~> d) -> Dot a b -> Dot c d Source Github # lmap :: forall (c :: DOT) (a :: DOT) (b :: DOT). (c ~> a) -> Dot a b -> Dot c b Source Github # rmap :: forall (b :: DOT) (d :: DOT) (a :: DOT). (b ~> d) -> Dot a b -> Dot a d Source Github # (\\) :: forall (a :: DOT) (b :: DOT) r. ((Ob a, Ob b) => r) -> Dot a b -> r Source Github # | |
| Costrong (Tensor :: DOT -> (DOT, DOT) -> Type) Dot Source Github # | |
| Show (Dot a b) Source Github # | |
pointsPerWire :: forall (as :: [Symbol]) (xs :: [Symbol]) (ys :: [Symbol]). (IsList as, IsList xs, IsList ys) => (Fin xs -> (Int, String)) -> (Fin ys -> (Int, String)) -> String -> Dot ('D xs) ('D ys) Source Github #
One point node for each wire of as. inAt and outAt say which wire's node each input and
output is attached to, and at which port. Drawing the (co)monoid on several wires as a single
point would not say which output continues which input.
wireAt :: forall {k} (as :: k). String -> Fin as -> (Int, String) Source Github #
Attaches at the given port of wire i's point.
eitherCopy :: forall (as :: [Symbol]). IsList as => String -> String -> Fin (as ++ as) -> (Int, String) Source Github #
Attaches wire i of either copy in as ++ as to wire i's point, the first copy at the
first port and the second at the second.
feedback :: Port -> String -> Port -> (Port, String, Port) Source Github #
A fed-back wire. One that returns to the node it leaves is attached at corners of its ports, so that Graphviz draws the loop beside the node and not across it; one between two nodes attaches as any other wire does.
bend :: String -> Port -> Port Source Github #
A port with the side it is drawn at replaced by the given corner.
swap2 :: forall (a :: Symbol) (b :: Symbol). (Ob a, Ob b) => Dot ('D '[a, b]) ('D '[b, a]) Source Github #
swapNode :: forall (a :: Symbol) (b :: Symbol). (Ob a, Ob b) => Dot ('D '[a, b]) ('D '[b, a]) Source Github #
node' :: forall (as :: [Symbol]) (bs :: [Symbol]). (IsList as, IsList bs) => NodeKind -> Vec as String -> Vec bs String -> String -> Dot ('D as) ('D bs) Source Github #
node :: forall (as :: [Symbol]) (bs :: [Symbol]). (IsList as, IsList bs) => String -> Dot ('D as) ('D bs) Source Github #
A node with the given name, with a port for each input along the top and each output along the bottom, in order, so that Graphviz draws the wires into it in order.
portedLabel :: Int -> Int -> String -> String Source Github #
An HTML-like label drawing the node as a rounded box: the name in the middle, with a row of
empty cells along the top edge for the inputs and along the bottom edge for the outputs, named
by the ports node attaches the wires to. The wires end at the box's edge.
nodeOrder :: [Either x Port] -> [(Port, String, Port)] -> Int -> [Int] Source Github #
The nodes in the order they are reached from the inputs, going along the wires, followed by any that no input reaches.
portOf :: Port -> String Source Github #
A port without its node and without the side it is drawn at (3:o0:s is :o0); a port that
is only a side keeps it (3:nw is :nw).
getData :: forall (as :: [Symbol]) (bs :: [Symbol]). Dot ('D as) ('D bs) -> DotData as bs Source Github #
onRank :: String -> String -> Int -> String Source Github #
A boundary node on the given rank, when its boundary has any wires.
header :: String Source Github #
The start of a Graphviz graph, with the fonts and wire style of every diagram.
statements :: forall (as :: [Symbol]) (bs :: [Symbol]). Dot ('D as) ('D bs) -> String Source Github #
The statements drawing a diagram. Each boundary is one node, i or o, with a port per
wire, so that Graphviz keeps the wires in order, and is left out when it has no wires.
unitAdj :: forall (l :: Symbol) (r :: Symbol). (Ob l, Ob r) => Dot ('D ('[] :: [Symbol])) ('D '[l, r]) Source Github #
counitAdj :: forall (l :: Symbol) (r :: Symbol). (Ob l, Ob r) => Dot ('D '[r, l]) ('D ('[] :: [Symbol])) Source Github #
Orphan instances
| CategoryOf Symbol Source Github # | The discrete category on type-level | ||||||||
Associated Types
| |||||||||