{-| Module : FiniteCategories Description : An example of select3 diagram. Copyright : Guillaume Sabbagh 2021 License : GPL-3 Maintainer : guillaumesabbagh@protonmail.com Stability : experimental Portability : portable An example of select3 diagram. -} module ExampleDiagram.ExampleSelectThreeDiagram ( selectThree, main ) where import RandomCompositionGraph.RandomCompositionGraph import System.Random import ExportGraphViz.ExportGraphViz (catToPdf,diagToPdf,diagToPdf2) import Diagram.Diagram (mkSelect3, src) import Utils.Sample import FiniteCategory.FiniteCategory hiding (FiniteCategoryError(..)) import Data.List ((\\)) import Data.Maybe (fromJust) (rcg1,newGen) = (mkRandomCompositionGraph 10 15 3 (mkStdGen 1234)) (f,newGen2) = (pickOne ((arrows rcg1)\\(identities rcg1)) newGen) (g,newGen3) = (pickOne ((arFrom rcg1 (target f))) newGen2) -- | We select a triangle in a random category. selectThree = fromJust $ (mkSelect3 rcg1 f g) -- | Export the diagram as a pdf with GraphViz. main = do putStrLn "Start of ExampleSelectThreeDiagram" catToPdf rcg1 "OutputGraphViz/Examples/Diagram/SelectThreeDiagram/rcg1" catToPdf (src selectThree) "OutputGraphViz/Examples/Diagram/SelectThreeDiagram/Three" diagToPdf selectThree "OutputGraphViz/Examples/Diagram/SelectThreeDiagram/functor" diagToPdf2 selectThree "OutputGraphViz/Examples/Diagram/SelectThreeDiagram/diag" putStrLn "End of ExampleSelectThreeDiagram"