{-| Module : FiniteCategories Description : An example of 'SafeCompositionGraph' pretty printed. Copyright : Guillaume Sabbagh 2022 License : GPL-3 Maintainer : guillaumesabbagh@protonmail.com Stability : experimental Portability : portable An example of 'SafeCompositionGraph' pretty printed. A 'SafeCompositionGraph' created from a string is also pretty printed. A random 'SafeCompositionGraph' is also pretty printed. -} module Math.FiniteCategories.SafeCompositionGraph.Example ( main ) where import qualified Data.WeakSet as Set import Data.WeakSet.Safe import Data.WeakMap.Safe import Math.FiniteCategory import Math.Categories import Math.FiniteCategories import Math.IO.PrettyPrint import Numeric.Natural import System.Random -- | An example of 'SafeCompositionGraph' pretty printed. main :: IO () main = do putStrLn "Start of Math.FiniteCategories.SafeCompositionGraph.Example" putStrLn $ pprintFiniteCategory (unsafeSafeCompositionGraph (unsafeGraph (set [1 :: Int,2,3]) (set [Arrow{sourceArrow=1,targetArrow=1,labelArrow='a'},Arrow{sourceArrow=1,targetArrow=2,labelArrow='b'},Arrow{sourceArrow=2,targetArrow=3,labelArrow='c'}])) (weakMap [([Arrow{sourceArrow=1,targetArrow=1,labelArrow='a'},Arrow{sourceArrow=1,targetArrow=1,labelArrow='a'}],[Arrow{sourceArrow=1,targetArrow=1,labelArrow='a'}])]) 3) putStrLn $ pprintFiniteCategory (unsafeSafeCompositionGraph (unsafeGraph (set [1 :: Int]) (set [Arrow{sourceArrow=1,targetArrow=1,labelArrow='a'}])) (weakMap []) 3) putStrLn $ pprintFiniteCategory (fst.defaultConstructRandomSafeCompositionGraph $ (mkStdGen 123456)) let (Right scg) = readSCGString "2\nA -f-> B -g-> C = A -h-> C" putStrLn $ pprintFiniteCategory scg putStrLn "End of Math.FiniteCategories.SafeCompositionGraph.Example"