packages feed

FiniteCategories-0.3.0.0: src/Math/Functors/Adjunction/Example.hs

{-| Module  : FiniteCategories
Description : An exemple of 'leftAdjoint' and 'rightAdjoint' use pretty printed.
Copyright   : Guillaume Sabbagh 2022
License     : GPL-3
Maintainer  : guillaumesabbagh@protonmail.com
Stability   : experimental
Portability : portable

An exemple of 'leftAdjoint' and 'rightAdjoint' use pretty printed.


-}
module Math.Functors.Adjunction.Example
(
    main
)
where
    import              Math.FiniteCategory  
    import              Math.FiniteCategories.Ens   
    import              Math.FiniteCategories.DiscreteCategory   
    import              Math.Categories.FunctorCategory   
    import              Math.Functors.Adjunction
    import              Math.Functors.DiagonalFunctor
    import              Math.IO.PrettyPrint
    import              Math.FiniteCategory

    
    import              Data.WeakSet             (Set)
    import qualified    Data.WeakSet           as Set
    import              Data.WeakSet.Safe
    import              Data.WeakMap             (Map)
    import qualified    Data.WeakMap           as Map
    import              Data.WeakMap.Safe
    
    -- | An exemple of 'leftAdjoint' and 'rightAdjoint' use pretty printed.
    main :: IO ()
    main = do
        putStrLn "Start of Math.Functors.Adjunction.Example"
        let universe = ens $ set [set [1 :: Int], set [3,4]]
        let indexing = discreteCategory $ set [0 :: Int,1]
        let diagFunct = diagonalFunctor indexing universe
        let leftAdj = leftAdjoint diagFunct
        let rightAdj = rightAdjoint diagFunct
        putStrLn $ pprintFiniteCategory universe 
        putStrLn $ pprintFiniteCategory indexing 
        putStrLn $ pprint (fst.anElement.(Map.mapToSet).omap $ leftAdj) 
        putStrLn $ pprint (selectObject universe (snd.anElement.(Map.mapToSet).omap $ leftAdj)) 
        putStrLn "End of Math.Functors.Adjunction.Example"