{-| Module : FiniteCategories Description : An example of 'SafeCompositionGraph' exported with GraphViz. Copyright : Guillaume Sabbagh 2022 License : GPL-3 Maintainer : guillaumesabbagh@protonmail.com Stability : experimental Portability : portable An example of 'SafeCompositionGraph' exported with GraphViz. A 'SafeCompositionGraph' created from a string is also exported. A random 'SafeCompositionGraph' is also exported. Export the categories in the directory "OutputGraphViz\/Examples\/FiniteCategories\/SafeCompositionGraph". -} 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.FiniteCategories.ExportGraphViz import Math.IO.PrettyPrint import Numeric.Natural import System.Random -- | An example of 'SafeCompositionGraph' exported with GraphViz. main :: IO () main = do putStrLn "Start of Math.FiniteCategories.SafeCompositionGraph.Example" catToPdf (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) "OutputGraphViz/Examples/FiniteCategories/SafeCompositionGraph/SafeCompositionGraph" catToPdf (unsafeSafeCompositionGraph (unsafeGraph (set [1 :: Int]) (set [Arrow{sourceArrow=1,targetArrow=1,labelArrow='a'}])) (weakMap []) 3) "OutputGraphViz/Examples/FiniteCategories/SafeCompositionGraph/SafeCompositionGraphOnFreeMonoid" catToPdf (fst.defaultConstructRandomSafeCompositionGraph $ (mkStdGen 123456)) "OutputGraphViz/Examples/FiniteCategories/SafeCompositionGraph/RandomSafeCompositionGraph" let (Right scg) = readSCGString "2\nA -f-> B -g-> C = A -h-> C" catToPdf scg "OutputGraphViz/Examples/FiniteCategories/SafeCompositionGraph/SafeCompositionGraphFromString" putStrLn "End of Math.FiniteCategories.SafeCompositionGraph.Example"