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

An example of 'CompositionGraph' pretty printed.

Examples of other categories transformed into 'CompositionGraph's are also pretty printed.

A random example of 'CompositionGraph' is also pretty printed.

A 'CompositionGraph' created from a string is also pretty printed.
-}
module Math.FiniteCategories.CompositionGraph.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 Math.FiniteCategories.FunctorCategory
    import Math.Categories.FinCat
    
    import Data.Text (pack)
    
    import System.Random
    import Numeric.Natural
    
    -- | An example of 'CompositionGraph' pretty printed.

    main :: IO ()
    main :: IO ()
main = do
        String -> IO ()
putStrLn String
"Start of Math.FiniteCategories.CompositionGraph.Example"
        String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ CompositionGraph Int Char -> String
forall c m o.
(FiniteCategory c m o, Morphism m o, PrettyPrint c, PrettyPrint m,
 PrettyPrint o, Eq m, Eq o) =>
c -> String
pprintFiniteCategory (Graph Int Char
-> CompositionLaw Int Char -> CompositionGraph Int Char
forall a b. Graph a b -> CompositionLaw a b -> CompositionGraph a b
unsafeCompositionGraph (Set Int -> Set (Arrow Int Char) -> Graph Int Char
forall n e. Set n -> Set (Arrow n e) -> Graph n e
unsafeGraph ([Int] -> Set Int
forall a. [a] -> Set a
set [Int
1 :: Int,Int
2,Int
3]) ([Arrow Int Char] -> Set (Arrow Int Char)
forall a. [a] -> Set a
set [Arrow{sourceArrow :: Int
sourceArrow=Int
1,targetArrow :: Int
targetArrow=Int
1,labelArrow :: Char
labelArrow=Char
'a'},Arrow{sourceArrow :: Int
sourceArrow=Int
1,targetArrow :: Int
targetArrow=Int
2,labelArrow :: Char
labelArrow=Char
'b'},Arrow{sourceArrow :: Int
sourceArrow=Int
2,targetArrow :: Int
targetArrow=Int
3,labelArrow :: Char
labelArrow=Char
'c'}])) (AssociationList [Arrow Int Char] [Arrow Int Char]
-> CompositionLaw Int Char
forall k v. AssociationList k v -> Map k v
weakMap [([Arrow{sourceArrow :: Int
sourceArrow=Int
1,targetArrow :: Int
targetArrow=Int
1,labelArrow :: Char
labelArrow=Char
'a'},Arrow{sourceArrow :: Int
sourceArrow=Int
1,targetArrow :: Int
targetArrow=Int
1,labelArrow :: Char
labelArrow=Char
'a'}],[Arrow{sourceArrow :: Int
sourceArrow=Int
1,targetArrow :: Int
targetArrow=Int
1,labelArrow :: Char
labelArrow=Char
'a'}])])) 
        String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ Diagram
  (Ens Char)
  (Function Char)
  (Set Char)
  (CompositionGraph (Set Char) (Function Char))
  (CGMorphism (Set Char) (Function Char))
  (Set Char)
-> String
forall a. PrettyPrint a => a -> String
pprint (Ens Char
-> Diagram
     (Ens Char)
     (Function Char)
     (Set Char)
     (CompositionGraph (Set Char) (Function Char))
     (CGMorphism (Set Char) (Function Char))
     (Set Char)
forall c m o.
(FiniteCategory c m o, Morphism m o, Eq m, Eq o) =>
c -> Diagram c m o (CompositionGraph o m) (CGMorphism o m) o
finiteCategoryToCompositionGraph (Set (Set Char) -> Ens Char
forall a. Set (Set a) -> Ens a
ens(Set (Set Char) -> Ens Char)
-> (String -> Set (Set Char)) -> String -> Ens Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Set Char -> Set (Set Char)
forall a. Set a -> Set (Set a)
Set.powerSet)(Set Char -> Set (Set Char))
-> (String -> Set Char) -> String -> Set (Set Char)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.String -> Set Char
forall a. [a] -> Set a
set (String -> Ens Char) -> String -> Ens Char
forall a b. (a -> b) -> a -> b
$ String
"AB"))
        String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ Diagram
  NumberCategory
  (IsSmallerThan Natural)
  Natural
  (CompositionGraph Natural (IsSmallerThan Natural))
  (CGMorphism Natural (IsSmallerThan Natural))
  Natural
-> String
forall a. PrettyPrint a => a -> String
pprint  (NumberCategory
-> Diagram
     NumberCategory
     (IsSmallerThan Natural)
     Natural
     (CompositionGraph Natural (IsSmallerThan Natural))
     (CGMorphism Natural (IsSmallerThan Natural))
     Natural
forall c m o.
(FiniteCategory c m o, Morphism m o, Eq m, Eq o) =>
c -> Diagram c m o (CompositionGraph o m) (CGMorphism o m) o
finiteCategoryToCompositionGraph (Natural -> NumberCategory
numberCategory Natural
4)) 
        String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ CompositionGraph Int Int -> String
forall c m o.
(FiniteCategory c m o, Morphism m o, PrettyPrint c, PrettyPrint m,
 PrettyPrint o, Eq m, Eq o) =>
c -> String
pprintFiniteCategory ((CompositionGraph Int Int, StdGen) -> CompositionGraph Int Int
forall a b. (a, b) -> a
fst((CompositionGraph Int Int, StdGen) -> CompositionGraph Int Int)
-> (StdGen -> (CompositionGraph Int Int, StdGen))
-> StdGen
-> CompositionGraph Int Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
.StdGen -> (CompositionGraph Int Int, StdGen)
forall g. RandomGen g => g -> (CompositionGraph Int Int, g)
defaultConstructRandomCompositionGraph (StdGen -> CompositionGraph Int Int)
-> StdGen -> CompositionGraph Int Int
forall a b. (a -> b) -> a -> b
$ (Int -> StdGen
mkStdGen Int
123456))
        String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ Diagram
  (CompositionGraph Int Int)
  (CGMorphism Int Int)
  Int
  (CompositionGraph Int Int)
  (CGMorphism Int Int)
  Int
-> String
forall a. PrettyPrint a => a -> String
pprint  ((Diagram
   (CompositionGraph Int Int)
   (CGMorphism Int Int)
   Int
   (CompositionGraph Int Int)
   (CGMorphism Int Int)
   Int,
 StdGen)
-> Diagram
     (CompositionGraph Int Int)
     (CGMorphism Int Int)
     Int
     (CompositionGraph Int Int)
     (CGMorphism Int Int)
     Int
forall a b. (a, b) -> a
fst((Diagram
    (CompositionGraph Int Int)
    (CGMorphism Int Int)
    Int
    (CompositionGraph Int Int)
    (CGMorphism Int Int)
    Int,
  StdGen)
 -> Diagram
      (CompositionGraph Int Int)
      (CGMorphism Int Int)
      Int
      (CompositionGraph Int Int)
      (CGMorphism Int Int)
      Int)
-> (StdGen
    -> (Diagram
          (CompositionGraph Int Int)
          (CGMorphism Int Int)
          Int
          (CompositionGraph Int Int)
          (CGMorphism Int Int)
          Int,
        StdGen))
-> StdGen
-> Diagram
     (CompositionGraph Int Int)
     (CGMorphism Int Int)
     Int
     (CompositionGraph Int Int)
     (CGMorphism Int Int)
     Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
.StdGen
-> (Diagram
      (CompositionGraph Int Int)
      (CGMorphism Int Int)
      Int
      (CompositionGraph Int Int)
      (CGMorphism Int Int)
      Int,
    StdGen)
forall g.
RandomGen g =>
g
-> (Diagram
      (CompositionGraph Int Int)
      (CGMorphism Int Int)
      Int
      (CompositionGraph Int Int)
      (CGMorphism Int Int)
      Int,
    g)
defaultConstructRandomDiagram (StdGen
 -> Diagram
      (CompositionGraph Int Int)
      (CGMorphism Int Int)
      Int
      (CompositionGraph Int Int)
      (CGMorphism Int Int)
      Int)
-> StdGen
-> Diagram
     (CompositionGraph Int Int)
     (CGMorphism Int Int)
     Int
     (CompositionGraph Int Int)
     (CGMorphism Int Int)
     Int
forall a b. (a -> b) -> a -> b
$ (Int -> StdGen
mkStdGen Int
12345678))
        let (Right CG
cg) = String
-> Either (FiniteCategoryError (CGMorphism Text Text) Text) CG
readCGString String
"A -f-> B -g-> C = A -h-> C"
        String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ CG -> String
forall c m o.
(FiniteCategory c m o, Morphism m o, PrettyPrint c, PrettyPrint m,
 PrettyPrint o, Eq m, Eq o) =>
c -> String
pprintFiniteCategory CG
cg
        let (Right CG
cg) = String
-> Either (FiniteCategoryError (CGMorphism Text Text) Text) CG
readCGString String
"A -f-> B\nB -g-> C\nC -h-> B\nB -g-> C -h-> B = <ID>\nC -h-> B -g-> C -h-> B -g-> C = C -h-> B -g-> C"
        String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ CG -> String
forall c m o.
(FiniteCategory c m o, Morphism m o, PrettyPrint c, PrettyPrint m,
 PrettyPrint o, Eq m, Eq o) =>
c -> String
pprintFiniteCategory CG
cg
        
        String -> IO ()
putStrLn (Int -> String -> String
forall a. Int -> [a] -> [a]
take Int
30 (Char -> String
forall a. a -> [a]
repeat Char
'\n'))
        
        -- let (Right cg1) = readCGString "A -f-> B"

        -- let (Right cg2) = readCGString "A -g-> C"

        -- let diag = discreteDiagram FinCat [cg1,cg2]

        -- let colimit = colimitOfCompositionGraphs diag (\x o -> (pack.show $ x) <> (pack ".")<>o) (\x m -> (pack.show$ x) <>(pack ".")<>m)

        
        -- putStrLn $ show $ nadir colimit

        -- putStrLn "\n\n\n"

        -- putStrLn $ show $ colimit

        
        let (Right CG
cg1) = String
-> Either (FiniteCategoryError (CGMorphism Text Text) Text) CG
readCGString String
"A -f-> B\nB -g-> C"
        let (Right CG
cg2) = String
-> Either (FiniteCategoryError (CGMorphism Text Text) Text) CG
readCGString String
"1 -a-> 2\n 2 -b-> 3"
        let (Right CG
cg3) = String
-> Either (FiniteCategoryError (CGMorphism Text Text) Text) CG
readCGString String
"A1 -(gof)a-> C2"
        let f :: FinFunctor CG (CGMorphism Text Text) Text
f = FinFunctor CG (CGMorphism Text Text) Text
-> FinFunctor CG (CGMorphism Text Text) Text
forall c1 m1 o1 c2 m2 o2.
(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq m1, Eq o1,
 Category c2 m2 o2, Morphism m2 o2) =>
Diagram c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2
completeDiagram Diagram{src :: CG
src = CG
cg3, tgt :: CG
tgt = CG
cg1, omap :: Map Text Text
omap = AssociationList Text Text -> Map Text Text
forall k v. AssociationList k v -> Map k v
weakMap [(String -> Text
pack String
"A1", String -> Text
pack String
"A"),(String -> Text
pack String
"C2", String -> Text
pack String
"C")], mmap :: Map (CGMorphism Text Text) (CGMorphism Text Text)
mmap = AssociationList (CGMorphism Text Text) (CGMorphism Text Text)
-> Map (CGMorphism Text Text) (CGMorphism Text Text)
forall k v. AssociationList k v -> Map k v
weakMap [(Set (CGMorphism Text Text) -> CGMorphism Text Text
forall a. Set a -> a
anElement (Set (CGMorphism Text Text) -> CGMorphism Text Text)
-> Set (CGMorphism Text Text) -> CGMorphism Text Text
forall a b. (a -> b) -> a -> b
$ CG -> Text -> Text -> Set (CGMorphism Text Text)
forall c m o.
(Category c m o, Morphism m o) =>
c -> o -> o -> Set m
genAr CG
cg3 (String -> Text
pack String
"A1") (String -> Text
pack String
"C2"), Set (CGMorphism Text Text) -> CGMorphism Text Text
forall a. Set a -> a
anElement (Set (CGMorphism Text Text) -> CGMorphism Text Text)
-> Set (CGMorphism Text Text) -> CGMorphism Text Text
forall a b. (a -> b) -> a -> b
$ CG -> Text -> Text -> Set (CGMorphism Text Text)
forall c m o.
(Category c m o, Morphism m o) =>
c -> o -> o -> Set m
ar CG
cg1 (String -> Text
pack String
"A") (String -> Text
pack String
"C"))]}
        let g :: FinFunctor CG (CGMorphism Text Text) Text
g = FinFunctor CG (CGMorphism Text Text) Text
-> FinFunctor CG (CGMorphism Text Text) Text
forall c1 m1 o1 c2 m2 o2.
(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq m1, Eq o1,
 Category c2 m2 o2, Morphism m2 o2) =>
Diagram c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2
completeDiagram Diagram{src :: CG
src = CG
cg3, tgt :: CG
tgt = CG
cg2, omap :: Map Text Text
omap = AssociationList Text Text -> Map Text Text
forall k v. AssociationList k v -> Map k v
weakMap [(String -> Text
pack String
"A1", String -> Text
pack String
"1"),(String -> Text
pack String
"C2", String -> Text
pack String
"2")], mmap :: Map (CGMorphism Text Text) (CGMorphism Text Text)
mmap = AssociationList (CGMorphism Text Text) (CGMorphism Text Text)
-> Map (CGMorphism Text Text) (CGMorphism Text Text)
forall k v. AssociationList k v -> Map k v
weakMap [(Set (CGMorphism Text Text) -> CGMorphism Text Text
forall a. Set a -> a
anElement (Set (CGMorphism Text Text) -> CGMorphism Text Text)
-> Set (CGMorphism Text Text) -> CGMorphism Text Text
forall a b. (a -> b) -> a -> b
$ CG -> Text -> Text -> Set (CGMorphism Text Text)
forall c m o.
(Category c m o, Morphism m o) =>
c -> o -> o -> Set m
genAr CG
cg3 (String -> Text
pack String
"A1") (String -> Text
pack String
"C2"), Set (CGMorphism Text Text) -> CGMorphism Text Text
forall a. Set a -> a
anElement (Set (CGMorphism Text Text) -> CGMorphism Text Text)
-> Set (CGMorphism Text Text) -> CGMorphism Text Text
forall a b. (a -> b) -> a -> b
$ CG -> Text -> Text -> Set (CGMorphism Text Text)
forall c m o.
(Category c m o, Morphism m o) =>
c -> o -> o -> Set m
ar CG
cg2 (String -> Text
pack String
"1") (String -> Text
pack String
"2"))]}
        let diag :: Diagram
  Hat
  HatAr
  HatOb
  (FinCat CG (CGMorphism Text Text) Text)
  (FinFunctor CG (CGMorphism Text Text) Text)
  CG
diag = Diagram
  Hat
  HatAr
  HatOb
  (FinCat CG (CGMorphism Text Text) Text)
  (FinFunctor CG (CGMorphism Text Text) Text)
  CG
-> Diagram
     Hat
     HatAr
     HatOb
     (FinCat CG (CGMorphism Text Text) Text)
     (FinFunctor CG (CGMorphism Text Text) Text)
     CG
forall c1 m1 o1 c2 m2 o2.
(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq m1, Eq o1,
 Category c2 m2 o2, Morphism m2 o2) =>
Diagram c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2
completeDiagram Diagram{src :: Hat
src = Hat
Hat, tgt :: FinCat CG (CGMorphism Text Text) Text
tgt = FinCat CG (CGMorphism Text Text) Text
forall c m o. FinCat c m o
FinCat, omap :: Map HatOb CG
omap = AssociationList HatOb CG -> Map HatOb CG
forall k v. AssociationList k v -> Map k v
weakMap [(HatOb
HatA,CG
cg3) , (HatOb
HatB,CG
cg2), (HatOb
HatC, CG
cg1)], mmap :: Map HatAr (FinFunctor CG (CGMorphism Text Text) Text)
mmap = AssociationList HatAr (FinFunctor CG (CGMorphism Text Text) Text)
-> Map HatAr (FinFunctor CG (CGMorphism Text Text) Text)
forall k v. AssociationList k v -> Map k v
weakMap [(HatAr
HatF, FinFunctor CG (CGMorphism Text Text) Text
g), (HatAr
HatG, FinFunctor CG (CGMorphism Text Text) Text
f)]}
        
        let coproduct :: Cocone
  Hat
  HatAr
  HatOb
  (FinCat CG (CGMorphism Text Text) Text)
  (FinFunctor CG (CGMorphism Text Text) Text)
  CG
coproduct = Diagram
  Hat
  HatAr
  HatOb
  (FinCat CG (CGMorphism Text Text) Text)
  (FinFunctor CG (CGMorphism Text Text) Text)
  CG
-> Cocone
     Hat
     HatAr
     HatOb
     (FinCat CG (CGMorphism Text Text) Text)
     (FinFunctor CG (CGMorphism Text Text) Text)
     CG
forall c1 m1 o1.
(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq o1, Show o1) =>
Diagram
  c1
  m1
  o1
  (FinCat CG (CGMorphism Text Text) Text)
  (FinFunctor CG (CGMorphism Text Text) Text)
  CG
-> Cocone
     c1
     m1
     o1
     (FinCat CG (CGMorphism Text Text) Text)
     (FinFunctor CG (CGMorphism Text Text) Text)
     CG
coproductOfTextCompositionGraphs Diagram
  Hat
  HatAr
  HatOb
  (FinCat CG (CGMorphism Text Text) Text)
  (FinFunctor CG (CGMorphism Text Text) Text)
  CG
diag
        String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ CG -> String
forall c m o.
(FiniteCategory c m o, Morphism m o, PrettyPrint c, PrettyPrint m,
 PrettyPrint o, Eq m, Eq o) =>
c -> String
pprintFiniteCategory (CG -> String) -> CG -> String
forall a b. (a -> b) -> a -> b
$ Cocone
  Hat
  HatAr
  HatOb
  (FinCat CG (CGMorphism Text Text) Text)
  (FinFunctor CG (CGMorphism Text Text) Text)
  CG
-> CG
forall c1 m1 o1 c2 m2 o2. Cocone c1 m1 o1 c2 m2 o2 -> o2
nadir Cocone
  Hat
  HatAr
  HatOb
  (FinCat CG (CGMorphism Text Text) Text)
  (FinFunctor CG (CGMorphism Text Text) Text)
  CG
coproduct
        String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ String
"\n\n"
        String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ Cocone
  Hat
  HatAr
  HatOb
  (FinCat CG (CGMorphism Text Text) Text)
  (FinFunctor CG (CGMorphism Text Text) Text)
  CG
-> String
forall a. Show a => a -> String
show (Cocone
   Hat
   HatAr
   HatOb
   (FinCat CG (CGMorphism Text Text) Text)
   (FinFunctor CG (CGMorphism Text Text) Text)
   CG
 -> String)
-> Cocone
     Hat
     HatAr
     HatOb
     (FinCat CG (CGMorphism Text Text) Text)
     (FinFunctor CG (CGMorphism Text Text) Text)
     CG
-> String
forall a b. (a -> b) -> a -> b
$ Cocone
  Hat
  HatAr
  HatOb
  (FinCat CG (CGMorphism Text Text) Text)
  (FinFunctor CG (CGMorphism Text Text) Text)
  CG
coproduct
        String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ String
"\n\n"
        
        
        -- let Just f_ = ((legsCocone coproduct) =>$ HatB) @? f

        -- let Just g_ = ((legsCocone coproduct) =>$ HatC) @? g

        -- let coequalizer = coequalizeCompositionGraphs f_ g_

        -- putStrLn $ pprintFiniteCategory $ tgt coequalizer

        -- putStrLn $ "\n\n"

        -- putStrLn $ show $ coequalizer

        -- putStrLn $ "\n\n"

        
        let colimit :: Cocone
  Hat
  HatAr
  HatOb
  (FinCat CG (CGMorphism Text Text) Text)
  (FinFunctor CG (CGMorphism Text Text) Text)
  CG
colimit = Diagram
  Hat
  HatAr
  HatOb
  (FinCat CG (CGMorphism Text Text) Text)
  (FinFunctor CG (CGMorphism Text Text) Text)
  CG
-> (HatOb -> Text -> Text)
-> (HatOb -> Text -> Text)
-> Cocone
     Hat
     HatAr
     HatOb
     (FinCat CG (CGMorphism Text Text) Text)
     (FinFunctor CG (CGMorphism Text Text) Text)
     CG
forall c1 m1 o1 a b.
(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq c1, Eq m1, Eq o1,
 Eq a, Eq b) =>
Diagram
  c1
  m1
  o1
  (FinCat (CompositionGraph a b) (CGMorphism a b) a)
  (FinFunctor (CompositionGraph a b) (CGMorphism a b) a)
  (CompositionGraph a b)
-> (o1 -> a -> a)
-> (o1 -> b -> b)
-> Cocone
     c1
     m1
     o1
     (FinCat (CompositionGraph a b) (CGMorphism a b) a)
     (FinFunctor (CompositionGraph a b) (CGMorphism a b) a)
     (CompositionGraph a b)
colimitOfCompositionGraphs Diagram
  Hat
  HatAr
  HatOb
  (FinCat CG (CGMorphism Text Text) Text)
  (FinFunctor CG (CGMorphism Text Text) Text)
  CG
diag (\HatOb
x Text
o -> (String -> Text
pack(String -> Text) -> (HatOb -> String) -> HatOb -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
.HatOb -> String
forall a. Show a => a -> String
show (HatOb -> Text) -> HatOb -> Text
forall a b. (a -> b) -> a -> b
$ HatOb
x) Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> (String -> Text
pack String
".")Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
o) (\HatOb
x Text
m -> (String -> Text
pack(String -> Text) -> (HatOb -> String) -> HatOb -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
.HatOb -> String
forall a. Show a => a -> String
show(HatOb -> Text) -> HatOb -> Text
forall a b. (a -> b) -> a -> b
$ HatOb
x) Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>(String -> Text
pack String
".")Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>Text
m)
        String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ CG -> String
forall c m o.
(FiniteCategory c m o, Morphism m o, PrettyPrint c, PrettyPrint m,
 PrettyPrint o, Eq m, Eq o) =>
c -> String
pprintFiniteCategory (CG -> String) -> CG -> String
forall a b. (a -> b) -> a -> b
$ Cocone
  Hat
  HatAr
  HatOb
  (FinCat CG (CGMorphism Text Text) Text)
  (FinFunctor CG (CGMorphism Text Text) Text)
  CG
-> CG
forall c1 m1 o1 c2 m2 o2. Cocone c1 m1 o1 c2 m2 o2 -> o2
nadir Cocone
  Hat
  HatAr
  HatOb
  (FinCat CG (CGMorphism Text Text) Text)
  (FinFunctor CG (CGMorphism Text Text) Text)
  CG
colimit
        String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ String
"\n\n"
        String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ Cocone
  Hat
  HatAr
  HatOb
  (FinCat CG (CGMorphism Text Text) Text)
  (FinFunctor CG (CGMorphism Text Text) Text)
  CG
-> String
forall a. Show a => a -> String
show (Cocone
   Hat
   HatAr
   HatOb
   (FinCat CG (CGMorphism Text Text) Text)
   (FinFunctor CG (CGMorphism Text Text) Text)
   CG
 -> String)
-> Cocone
     Hat
     HatAr
     HatOb
     (FinCat CG (CGMorphism Text Text) Text)
     (FinFunctor CG (CGMorphism Text Text) Text)
     CG
-> String
forall a b. (a -> b) -> a -> b
$ Cocone
  Hat
  HatAr
  HatOb
  (FinCat CG (CGMorphism Text Text) Text)
  (FinFunctor CG (CGMorphism Text Text) Text)
  CG
colimit
        String -> IO ()
putStrLn String
"End of Math.FiniteCategories.CompositionGraph.Example"