{-| Module : FiniteCategories Description : An example of product category. Copyright : Guillaume Sabbagh 2021 License : GPL-3 Maintainer : guillaumesabbagh@protonmail.com Stability : experimental Portability : portable An example of product category. -} module ExampleProductCategory.ExampleProductCategory ( main ) where import CompositionGraph.CompositionGraph import ExportGraphViz.ExportGraphViz (catToPdf, diagToPdf, diagToPdf2) import FiniteCategory.FiniteCategory hiding (f,g,h,i,j) import Data.Text (Text, pack) import ProductCategory.ProductCategory f = (pack "A", pack "B", 1) :: Arrow Text Int g = (pack "A", pack "C", 2) :: Arrow Text Int h = (pack "B", pack "D", 3) :: Arrow Text Int i = (pack "C", pack "D", 4) :: Arrow Text Int -- | A composition law defined by hand. myLaw = [] myGraph = (pack.pure <$> ['A'..'D'], [f,g,h,i]) -- | An example of a composition graph Right square = mkCompositionGraph myGraph myLaw j = (pack "X", pack "Y", 9) :: Arrow Text Int -- | A composition law defined by hand. myLaw2 = [] myGraph2 = (pack.pure <$> ['X'..'Y'], [j]) -- | An example of a composition graph Right arrow = mkCompositionGraph myGraph2 myLaw2 prod = ProductCategory square arrow -- | Exports the composition graphs and its Yoneda embedding as pdf files with GraphViz. main = do putStrLn "Start of ExampleProductCategory" catToPdf square "OutputGraphViz/Examples/ProductCategory/square" catToPdf arrow "OutputGraphViz/Examples/ProductCategory/arrow" catToPdf prod "OutputGraphViz/Examples/ProductCategory/prod" putStrLn "End of ExampleProductCategory"