packages feed

FiniteCategories-0.1.0.0: test/ExampleCat/ExamplePartialFinCat.hs

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

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

    -- | A category with {1,2} and {3} as object and applications as morphisms.
    set1 = FinOrdSet [fromList [1]] :: 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 = PartialFinCat [set1,set2]

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