packages feed

FiniteCategories-0.1.0.0: test/ExampleCat/ExampleFunctor.hs

{-| Module  : FiniteCategories
Description : An example of functor.
Copyright   : Guillaume Sabbagh 2021
License     : GPL-3
Maintainer  : guillaumesabbagh@protonmail.com
Stability   : experimental
Portability : portable

An example of functor.
-}
module ExampleCat.ExampleFunctor
(
    funct,
    main
)
where
    import              Cat.FinCat                                      (FinCat(..))
    import              FiniteCategory.FiniteCategory
    import              RandomCompositionGraph.RandomCompositionGraph
    import              CompositionGraph.CompositionGraph
    import              System.Random                                   
    import              ExportGraphViz.ExportGraphViz                   (catToPdf,genToPdf,diagToPdf,diagToPdf2)
    import              Cat.FinCat
    import              Diagram.Conversion

    (rcg1,newGen) = (mkRandomCompositionGraph 5 10 5 (mkStdGen 8))
    
    cat = FinCat [rcg1]
    
    -- | An arbitrary functor from the random composition graph to itself.
    funct = (arrows cat) !! 51

    -- | Export the category of finCat containing a random composition graph as a pdf with GraphViz.
    main = do 
        putStrLn "Start of ExampleFunctor"
        catToPdf rcg1 "OutputGraphViz/Examples/Cat/Functor/rcg1"
        catToPdf cat "OutputGraphViz/Examples/Cat/Functor/catRCG"
        diagToPdf (finFunctorToDiagram funct) "OutputGraphViz/Examples/Cat/Functor/functor"
        diagToPdf2 (finFunctorToDiagram funct) "OutputGraphViz/Examples/Cat/Functor/diag"
        putStrLn "End of ExampleFunctor"