packages feed

FiniteCategories-0.1.0.0: test/ExampleCat/ExampleCat.hs

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

An example of category of categories.
-}
module ExampleCat.ExampleCat
(
    set1, set2, cat,
    main
)
where
    import Prelude hiding (fmap, Functor)
    import              Cat.FinCat                             (FinCat(..))
    import              Set.FinOrdSet                             (FinOrdSet(..))
    import              Data.Set                               (fromList)
    import              ExportGraphViz.ExportGraphViz          (catToPdf,genToPdf)
    import              Cat.FinCat
    import              FiniteCategory.FiniteCategory

    -- | A category with {1,2} and {3} as object and applications as morphisms.
    set1 = FinOrdSet [fromList [1, 2], fromList [3]] :: FinOrdSet Int
    -- | A category with {1,2} as object and applications as morphisms.
    set2 = FinOrdSet [fromList [1,2]] :: FinOrdSet Int
    
    -- | A category with the two previous categories as objects
    cat = FinCat [set1,set2]

    -- | Export all the previously defined categories as pdf with GraphViz.
    main = do 
        putStrLn "Start of ExampleCat"
        catToPdf set1 "OutputGraphViz/Examples/Cat/CatOfSet/set1"
        catToPdf set2 "OutputGraphViz/Examples/Cat/CatOfSet/set2"
        catToPdf cat "OutputGraphViz/Examples/Cat/CatOfSet/cat"
        putStrLn "End of ExampleCat"