packages feed

FiniteCategories-0.1.0.0: test/ExampleSet/ExamplePowerSet.hs

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

An example of power set category.
-}

module ExampleSet.ExamplePowerSet
(
    powerSet,
    main
)
where
    import              Set.FinSet
    import              ExportGraphViz.ExportGraphViz          (catToPdf,genToPdf)

    -- | A category with all subsets of {1,2,3} as objects and applications as morphisms.
    powerSet = powerFinSet $ Collection $ Elem <$> [1..3] :: FinSet Int
    powerSetCat = FinSetCat $ toList powerSet

    -- | Export the power set of {1,2,3} as a pdf with GraphViz.
    main = do
        putStrLn "Start of ExamplePowerSet"
        catToPdf powerSetCat "OutputGraphViz/Examples/Set/powerSet"
        putStrLn "End of ExamplePowerSet"