Copyright | Guillaume Sabbagh 2022 |
---|---|
License | GPL-3 |
Maintainer | guillaumesabbagh@protonmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
This module is a way of exporting finite categories with GraphViz.
Every function assumes that the FiniteCategory
is a FiniteCategory
, if you want to export a category without implementing an instantiation of FiniteCategory
, you can instantiate FiniteCategory
with the default functions defaultGenAr
and defaultDecompose
.
Synopsis
- categoryToGraph :: (Eq o, PrettyPrint o, PrettyPrint m, Morphism m o, FiniteCategory c m o) => c -> Gr String String
- catToDot :: (Eq o, PrettyPrint o, PrettyPrint m, Morphism m o, FiniteCategory c m o) => c -> String -> IO ()
- catToPdf :: (Eq o, PrettyPrint o, PrettyPrint m, Morphism m o, FiniteCategory c m o) => c -> String -> IO ()
- genToDot :: (Eq o, PrettyPrint o, PrettyPrint m, Morphism m o, FiniteCategory c m o) => c -> String -> IO ()
- genToPdf :: (Eq o, PrettyPrint o, PrettyPrint m, Morphism m o, FiniteCategory c m o) => c -> String -> IO ()
- categoryToGraphFormat :: (Eq o, Morphism m o, FiniteCategory c m o) => c -> (o -> String) -> (m -> String) -> Gr String String
- catToDotFormat :: (Eq o, Morphism m o, FiniteCategory c m o) => c -> (o -> String) -> (m -> String) -> String -> IO ()
- catToPdfFormat :: (Eq o, Morphism m o, FiniteCategory c m o) => c -> (o -> String) -> (m -> String) -> String -> IO ()
- diagToDotCluster :: (Eq c1, Eq o1, PrettyPrint o1, PrettyPrint m1, Morphism m1 o1, FiniteCategory c1 m1 o1, Eq c2, Eq o2, PrettyPrint o2, PrettyPrint m2, Morphism m2 o2, FiniteCategory c2 m2 o2) => Diagram c1 m1 o1 c2 m2 o2 -> String -> IO ()
- diagToPdfCluster :: (Eq c1, Eq o1, PrettyPrint o1, PrettyPrint m1, Morphism m1 o1, FiniteCategory c1 m1 o1, Eq c2, Eq o2, PrettyPrint o2, PrettyPrint m2, Morphism m2 o2, FiniteCategory c2 m2 o2) => Diagram c1 m1 o1 c2 m2 o2 -> String -> IO ()
- diagToDot :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, PrettyPrint m2, PrettyPrint o2) => Diagram c1 m1 o1 c2 m2 o2 -> String -> IO ()
- diagToPdf :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, PrettyPrint m2, PrettyPrint o2) => Diagram c1 m1 o1 c2 m2 o2 -> String -> IO ()
- diagToDot2 :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, PrettyPrint m2, PrettyPrint o2) => Diagram c1 m1 o1 c2 m2 o2 -> String -> IO ()
- diagToPdf2 :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, PrettyPrint m2, PrettyPrint o2) => Diagram c1 m1 o1 c2 m2 o2 -> String -> IO ()
- diagToDot2Format :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, PrettyPrint m2, PrettyPrint o2) => Diagram c1 m1 o1 c2 m2 o2 -> (o2 -> String) -> (m2 -> String) -> String -> IO ()
- diagToPdf2Format :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, PrettyPrint m2, PrettyPrint o2) => Diagram c1 m1 o1 c2 m2 o2 -> (o2 -> String) -> (m2 -> String) -> String -> IO ()
- natToDot :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, Eq c1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, Eq c2, PrettyPrint m2, PrettyPrint o2) => NaturalTransformation c1 m1 o1 c2 m2 o2 -> String -> IO ()
- natToPdf :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, Eq c1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, Eq c2, PrettyPrint m2, PrettyPrint o2) => NaturalTransformation c1 m1 o1 c2 m2 o2 -> String -> IO ()
- natToDotFormat :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, Eq c1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, Eq c2, PrettyPrint m2, PrettyPrint o2) => NaturalTransformation c1 m1 o1 c2 m2 o2 -> (o2 -> String) -> (m2 -> String) -> String -> IO ()
- natToPdfFormat :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, Eq c1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, Eq c2, PrettyPrint m2, PrettyPrint o2) => NaturalTransformation c1 m1 o1 c2 m2 o2 -> (o2 -> String) -> (m2 -> String) -> String -> IO ()
Visualize categories
categoryToGraph :: (Eq o, PrettyPrint o, PrettyPrint m, Morphism m o, FiniteCategory c m o) => c -> Gr String String Source #
Transform a category into an underlying inductive graph.
catToDot :: (Eq o, PrettyPrint o, PrettyPrint m, Morphism m o, FiniteCategory c m o) => c -> String -> IO () Source #
Export a category with GraphViz. If the category is too large, use genToDot
instead.
The black arrows are generating arrows, grey one are generated arrows.
catToPdf :: (Eq o, PrettyPrint o, PrettyPrint m, Morphism m o, FiniteCategory c m o) => c -> String -> IO () Source #
Export a category with GraphViz. If the category is too large, use genToPdf
instead.
The black arrows are generating arrows, grey one are generated arrows.
genToDot :: (Eq o, PrettyPrint o, PrettyPrint m, Morphism m o, FiniteCategory c m o) => c -> String -> IO () Source #
Export the generator of a category with GraphViz. Use this when the category is too large to be fully exported.
genToPdf :: (Eq o, PrettyPrint o, PrettyPrint m, Morphism m o, FiniteCategory c m o) => c -> String -> IO () Source #
Export the generator of a category with GraphViz. Use this when the category is to large to be fully exported.
categoryToGraphFormat :: (Eq o, Morphism m o, FiniteCategory c m o) => c -> (o -> String) -> (m -> String) -> Gr String String Source #
Transform a category into an underlying inductive graph using formatting functions.
catToDotFormat :: (Eq o, Morphism m o, FiniteCategory c m o) => c -> (o -> String) -> (m -> String) -> String -> IO () Source #
Export a category with GraphViz, format the objects and the morphisms. If the category is too large, use genToDot
instead.
The black arrows are generating arrows, grey one are generated arrows.
catToPdfFormat :: (Eq o, Morphism m o, FiniteCategory c m o) => c -> (o -> String) -> (m -> String) -> String -> IO () Source #
Export a category with GraphViz and format objects and arrows. If the category is too large, use genToPdf
instead.
The black arrows are generating arrows, grey one are generated arrows.
Visualize diagrams
diagToDotCluster :: (Eq c1, Eq o1, PrettyPrint o1, PrettyPrint m1, Morphism m1 o1, FiniteCategory c1 m1 o1, Eq c2, Eq o2, PrettyPrint o2, PrettyPrint m2, Morphism m2 o2, FiniteCategory c2 m2 o2) => Diagram c1 m1 o1 c2 m2 o2 -> String -> IO () Source #
Export a functor with GraphViz such that the source category is in green, the target in blue, the objects mapped together are in the same cluster.
diagToPdfCluster :: (Eq c1, Eq o1, PrettyPrint o1, PrettyPrint m1, Morphism m1 o1, FiniteCategory c1 m1 o1, Eq c2, Eq o2, PrettyPrint o2, PrettyPrint m2, Morphism m2 o2, FiniteCategory c2 m2 o2) => Diagram c1 m1 o1 c2 m2 o2 -> String -> IO () Source #
Export a functor as a pdf with GraphViz such that the source category is in green, the target in blue, the objects mapped together are in the same cluster.
diagToDot :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, PrettyPrint m2, PrettyPrint o2) => Diagram c1 m1 o1 c2 m2 o2 -> String -> IO () Source #
Export a diagram with GraphViz such that the source category is in green, the target in blue, each morphism is represented by a node.
diagToPdf :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, PrettyPrint m2, PrettyPrint o2) => Diagram c1 m1 o1 c2 m2 o2 -> String -> IO () Source #
Export a diagram as a pdf with GraphViz such that the source category is in green, the target in blue, each morphism is represented by a node.
diagToDot2 :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, PrettyPrint m2, PrettyPrint o2) => Diagram c1 m1 o1 c2 m2 o2 -> String -> IO () Source #
Export a diagram with GraphViz such that a node or an arrow is in orange if it is the target of the functor.
diagToPdf2 :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, PrettyPrint m2, PrettyPrint o2) => Diagram c1 m1 o1 c2 m2 o2 -> String -> IO () Source #
Export a diagram as a pdf with GraphViz such that a node or an arrow is in orange if it is the target of the functor.
diagToDot2Format :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, PrettyPrint m2, PrettyPrint o2) => Diagram c1 m1 o1 c2 m2 o2 -> (o2 -> String) -> (m2 -> String) -> String -> IO () Source #
Export a diagram with GraphViz such that a node or an arrow is in orange if it is the target of the functor.
Allows to format the name of the objects and of the morphisms.
diagToPdf2Format :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, PrettyPrint m2, PrettyPrint o2) => Diagram c1 m1 o1 c2 m2 o2 -> (o2 -> String) -> (m2 -> String) -> String -> IO () Source #
Export a diagram as a pdf with GraphViz such that a node or an arrow is in orange if it is the target of the functor.
Allows to format the name of the objects and of the morphisms.
Visualize natural transformations
natToDot :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, Eq c1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, Eq c2, PrettyPrint m2, PrettyPrint o2) => NaturalTransformation c1 m1 o1 c2 m2 o2 -> String -> IO () Source #
Export a natural transformation with GraphViz such that the source diagram is in green, the target diagram is in blue and the translation is in yellow.
natToPdf :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, Eq c1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, Eq c2, PrettyPrint m2, PrettyPrint o2) => NaturalTransformation c1 m1 o1 c2 m2 o2 -> String -> IO () Source #
Export a natural transformation as pdf with GraphViz such that the source diagram is in green, the target diagram is in blue and the translation is in yellow.
natToDotFormat :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, Eq c1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, Eq c2, PrettyPrint m2, PrettyPrint o2) => NaturalTransformation c1 m1 o1 c2 m2 o2 -> (o2 -> String) -> (m2 -> String) -> String -> IO () Source #
Export a natural transformation with GraphViz such that the source diagram is in green, the target diagram is in blue and the translation is in yellow.
Allows to format the name of the objects and of the morphisms.
natToPdfFormat :: (Morphism m1 o1, FiniteCategory c1 m1 o1, Eq o1, Eq m1, Eq c1, PrettyPrint m1, PrettyPrint o1, Morphism m2 o2, FiniteCategory c2 m2 o2, Eq o2, Eq m2, Eq c2, PrettyPrint m2, PrettyPrint o2) => NaturalTransformation c1 m1 o1 c2 m2 o2 -> (o2 -> String) -> (m2 -> String) -> String -> IO () Source #
Export a natural transformation as pdf with GraphViz such that the source diagram is in green, the target diagram is in blue and the translation is in yellow.
Allows to format the name of the objects and of the morphisms.