packages feed

FiniteCategories-0.1.0.0: test/ExampleSet/ExampleSet.hs

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

An example of set category.
-}
module ExampleSet.ExampleSet
(
    set,
    setCat,
    main
)
where
    import              Set.FinSet
    import              ExportGraphViz.ExportGraphViz          (catToPdf,genToPdf)

    -- | A set containing {1,2} and {1,2,3}.
    set = Collection [Collection $ Elem <$> [1,2], Collection $ Elem <$> [1,2,3]] :: FinSet Int
    
    -- | The category containing {1,2} and {1,2,3} as objects.
    setCat = FinSetCat $ toList set

    -- | Export the category @set@ as a pdf with GraphViz.
    main = do
        putStrLn "Start of ExampleSet"
        catToPdf setCat "OutputGraphViz/Examples/Set/set"
        genToPdf setCat "OutputGraphViz/Examples/Set/setGen"
        putStrLn "End of ExampleSet"