{-| Module  : FiniteCategories
Description : Examples of 'CompositionGraph's.
Copyright   : Guillaume Sabbagh 2023
License     : GPL-3
Maintainer  : guillaumesabbagh@protonmail.com
Stability   : experimental
Portability : portable

Examples of 'CompositionGraph's, other categories transformed into 'CompositionGraph's, a random example of 'CompositionGraph', a 'CompositionGraph' created from a string and a colimit of 'CompositionGraph's.

See also 'exampleCgdString' in Math.FiniteCategories.FunctorCategory.Examples for constructing diagrams of 'CompositionGraph's.
-}
module Math.FiniteCategories.CompositionGraph.Examples
(
    exampleCompositionGraph,
    exampleCompositionGraph2,
    exampleSetTransformedIntoACompositionGraph,
    example4TransformedIntoACompositionGraph,
    exampleRandomCompositionGraph,
    exampleCgString,
    exampleCgString2,
    exampleDiagramToCompositionGraphs,
    exampleColimitOfCompositionGraphs,
)
where
    import qualified Data.WeakSet as Set
    import Data.WeakSet.Safe
    import Data.WeakMap.Safe
    
    import Math.FiniteCategory
    import Math.Categories
    import Math.CocompleteCategory
    import Math.FiniteCategories
    import Math.FiniteCategories.FunctorCategory
    import Math.Categories.FinCat
    
    import Data.Text (pack , Text)
    
    import System.Random
    import Numeric.Natural
    
    -- | An example of 'CompositionGraph' constructed with the smart constructor 'compositionGraph'.

    exampleCompositionGraph :: CompositionGraph Int Char
    exampleCompositionGraph :: CompositionGraph Int Char
exampleCompositionGraph = CompositionGraph Int Char
result
        where
            Just Graph Int Char
underlyingGraph = Set Int -> Set (Arrow Int Char) -> Maybe (Graph Int Char)
forall n e. Eq n => Set n -> Set (Arrow n e) -> Maybe (Graph n e)
graph ([Int] -> Set Int
forall a. [a] -> Set a
set [Int
1,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'}])
            compositionLaw :: Map [Arrow Int Char] [Arrow Int Char]
compositionLaw = AssociationList [Arrow Int Char] [Arrow Int Char]
-> Map [Arrow Int Char] [Arrow 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'}])]
            Right CompositionGraph Int Char
result = Graph Int Char
-> Map [Arrow Int Char] [Arrow Int Char]
-> Either
     (FiniteCategoryError (CGMorphism Int Char) Int)
     (CompositionGraph Int Char)
forall a b.
(Eq a, Eq b) =>
Graph a b
-> CompositionLaw a b
-> Either
     (FiniteCategoryError (CGMorphism a b) a) (CompositionGraph a b)
compositionGraph Graph Int Char
underlyingGraph Map [Arrow Int Char] [Arrow Int Char]
compositionLaw
            
    -- | An example of 'CompositionGraph' constructed with the smart constructor 'unsafeCompositionGraph'.

    exampleCompositionGraph2 :: CompositionGraph Int Char
    exampleCompositionGraph2 :: CompositionGraph Int Char
exampleCompositionGraph2 = CompositionGraph Int Char
result
        where
            underlyingGraph :: Graph Int Char
underlyingGraph = 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
2]) ([Arrow Int Char] -> Set (Arrow Int Char)
forall a. [a] -> Set a
set [Arrow{sourceArrow :: Int
sourceArrow=Int
1,targetArrow :: Int
targetArrow=Int
2,labelArrow :: Char
labelArrow=Char
'f'}])
            compositionLaw :: Map k v
compositionLaw = AssociationList k v -> Map k v
forall k v. AssociationList k v -> Map k v
weakMap []
            result :: CompositionGraph Int Char
result = Graph Int Char
-> Map [Arrow Int Char] [Arrow Int Char]
-> CompositionGraph Int Char
forall a b. Graph a b -> CompositionLaw a b -> CompositionGraph a b
unsafeCompositionGraph Graph Int Char
underlyingGraph Map [Arrow Int Char] [Arrow Int Char]
forall {k} {v}. Map k v
compositionLaw
            
    
    -- | The insertion diagram from S (the subcategory of Set containing all subsets of the set {'A','B'} as objects)  to the same category transformed into a 'CompositionGraph'.

    exampleSetTransformedIntoACompositionGraph :: Diagram (Ens Char) (Function Char) (Set.Set Char) (CompositionGraph (Set.Set Char) (Function Char)) (CGMorphism (Set.Set Char) (Function Char)) (Set.Set Char)
    exampleSetTransformedIntoACompositionGraph :: Diagram
  (Ens Char)
  (Function Char)
  (Set Char)
  (CompositionGraph (Set Char) (Function Char))
  (CGMorphism (Set Char) (Function Char))
  (Set Char)
exampleSetTransformedIntoACompositionGraph = 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
finiteCategoryToCompositionGraph2 Ens Char
s
        where
            s :: Ens Char
s = Set (Set Char) -> Ens Char
forall a. Set (Set a) -> Ens a
ens(Set (Set Char) -> Ens Char)
-> ([Char] -> Set (Set Char)) -> [Char] -> 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))
-> ([Char] -> Set Char) -> [Char] -> Set (Set Char)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.[Char] -> Set Char
forall a. [a] -> Set a
set ([Char] -> Ens Char) -> [Char] -> Ens Char
forall a b. (a -> b) -> a -> b
$ [Char]
"AB"
            
    -- | The insertion diagram from 4 to the same category transformed into a 'CompositionGraph'.

    example4TransformedIntoACompositionGraph :: Diagram NumberCategory NumberCategoryMorphism NumberCategoryObject (CompositionGraph NumberCategoryObject NumberCategoryMorphism) (CGMorphism NumberCategoryObject NumberCategoryMorphism) NumberCategoryObject
    example4TransformedIntoACompositionGraph :: Diagram
  NumberCategory
  NumberCategoryMorphism
  NumberCategoryObject
  (CompositionGraph NumberCategoryObject NumberCategoryMorphism)
  (CGMorphism NumberCategoryObject NumberCategoryMorphism)
  NumberCategoryObject
example4TransformedIntoACompositionGraph = NumberCategory
-> Diagram
     NumberCategory
     NumberCategoryMorphism
     NumberCategoryObject
     (CompositionGraph NumberCategoryObject NumberCategoryMorphism)
     (CGMorphism NumberCategoryObject NumberCategoryMorphism)
     NumberCategoryObject
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
finiteCategoryToCompositionGraph2 (NumberCategoryObject -> NumberCategory
numberCategory NumberCategoryObject
4)
    
    -- | An example of random 'CompositionGraph'.

    exampleRandomCompositionGraph :: CompositionGraph Int Int
    exampleRandomCompositionGraph :: CompositionGraph Int Int
exampleRandomCompositionGraph = CompositionGraph Int Int
result
        where
            randomGen :: StdGen
randomGen = Int -> StdGen
mkStdGen Int
123456
            (CompositionGraph Int Int
result,StdGen
newRandomGen) = StdGen -> (CompositionGraph Int Int, StdGen)
forall g. RandomGen g => g -> (CompositionGraph Int Int, g)
defaultConstructRandomCompositionGraph StdGen
randomGen
            
    -- | An example of 'CompositionGraph' read from a .cg string.

    exampleCgString :: CompositionGraph Text Text
    exampleCgString :: CompositionGraph Text Text
exampleCgString = CompositionGraph Text Text
cg
        where
            Right CompositionGraph Text Text
cg = [Char]
-> Either
     (FiniteCategoryError (CGMorphism Text Text) Text)
     (CompositionGraph Text Text)
readCGString [Char]
"A -f-> B -g-> C = A -h-> C"
            
    -- | A second example of 'CompositionGraph' read from a .cg string.

    exampleCgString2 :: CompositionGraph Text Text
    exampleCgString2 :: CompositionGraph Text Text
exampleCgString2 = CompositionGraph Text Text
cg
        where
            Right CompositionGraph Text Text
cg = [Char]
-> Either
     (FiniteCategoryError (CGMorphism Text Text) Text)
     (CompositionGraph Text Text)
readCGString [Char]
"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"
            
    -- | An example of 'Diagram' from 'Hat' to 'FinCat' of 'CompositionGraph's.  

    exampleDiagramToCompositionGraphs :: Diagram Hat HatAr HatOb (FinCat (CompositionGraph Text Text) (CGMorphism Text Text) Text) (FinFunctor (CompositionGraph Text Text) (CGMorphism Text Text) Text) (CompositionGraph Text Text)
    exampleDiagramToCompositionGraphs :: Diagram
  Hat
  HatAr
  HatOb
  (FinCat (CompositionGraph Text Text) (CGMorphism Text Text) Text)
  (FinFunctor
     (CompositionGraph Text Text) (CGMorphism Text Text) Text)
  (CompositionGraph Text Text)
exampleDiagramToCompositionGraphs = Diagram
  Hat
  HatAr
  HatOb
  (FinCat (CompositionGraph Text Text) (CGMorphism Text Text) Text)
  (FinFunctor
     (CompositionGraph Text Text) (CGMorphism Text Text) Text)
  (CompositionGraph Text Text)
-> Diagram
     Hat
     HatAr
     HatOb
     (FinCat (CompositionGraph Text Text) (CGMorphism Text Text) Text)
     (FinFunctor
        (CompositionGraph Text Text) (CGMorphism Text Text) Text)
     (CompositionGraph 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
  Hat
  HatAr
  HatOb
  (FinCat (CompositionGraph Text Text) (CGMorphism Text Text) Text)
  (FinFunctor
     (CompositionGraph Text Text) (CGMorphism Text Text) Text)
  (CompositionGraph Text Text)
forall {c} {m} {o}.
Diagram
  Hat
  HatAr
  HatOb
  (FinCat c m o)
  (FinFunctor
     (CompositionGraph Text Text) (CGMorphism Text Text) Text)
  (CompositionGraph Text Text)
diag
        where
            (Right CompositionGraph Text Text
cg1) = [Char]
-> Either
     (FiniteCategoryError (CGMorphism Text Text) Text)
     (CompositionGraph Text Text)
readCGString [Char]
"A"
            (Right CompositionGraph Text Text
cg2) = [Char]
-> Either
     (FiniteCategoryError (CGMorphism Text Text) Text)
     (CompositionGraph Text Text)
readCGString [Char]
"A\nB"
            (Right CompositionGraph Text Text
cg3) = [Char]
-> Either
     (FiniteCategoryError (CGMorphism Text Text) Text)
     (CompositionGraph Text Text)
readCGString [Char]
"A\nC"
            f :: FinFunctor (CompositionGraph Text Text) (CGMorphism Text Text) Text
f = FinFunctor (CompositionGraph Text Text) (CGMorphism Text Text) Text
-> FinFunctor
     (CompositionGraph Text Text) (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 :: CompositionGraph Text Text
src = CompositionGraph Text Text
cg1, tgt :: CompositionGraph Text Text
tgt = CompositionGraph Text Text
cg2, omap :: Map Text Text
omap = AssociationList Text Text -> Map Text Text
forall k v. AssociationList k v -> Map k v
weakMap [([Char] -> Text
pack [Char]
"A", [Char] -> Text
pack [Char]
"A")], 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 []}
            g :: FinFunctor (CompositionGraph Text Text) (CGMorphism Text Text) Text
g = FinFunctor (CompositionGraph Text Text) (CGMorphism Text Text) Text
-> FinFunctor
     (CompositionGraph Text Text) (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 :: CompositionGraph Text Text
src = CompositionGraph Text Text
cg1, tgt :: CompositionGraph Text Text
tgt = CompositionGraph Text Text
cg3, omap :: Map Text Text
omap = AssociationList Text Text -> Map Text Text
forall k v. AssociationList k v -> Map k v
weakMap [([Char] -> Text
pack [Char]
"A", [Char] -> Text
pack [Char]
"A")], 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 []}
            diag :: Diagram
  Hat
  HatAr
  HatOb
  (FinCat c m o)
  (FinFunctor
     (CompositionGraph Text Text) (CGMorphism Text Text) Text)
  (CompositionGraph Text Text)
diag = Diagram{src :: Hat
src = Hat
Hat, tgt :: FinCat c m o
tgt = FinCat c m o
forall c m o. FinCat c m o
FinCat, omap :: Map HatOb (CompositionGraph Text Text)
omap = AssociationList HatOb (CompositionGraph Text Text)
-> Map HatOb (CompositionGraph Text Text)
forall k v. AssociationList k v -> Map k v
weakMap [(HatOb
HatA,CompositionGraph Text Text
cg1) , (HatOb
HatB,CompositionGraph Text Text
cg2), (HatOb
HatC, CompositionGraph Text Text
cg3)], mmap :: Map
  HatAr
  (FinFunctor
     (CompositionGraph Text Text) (CGMorphism Text Text) Text)
mmap = AssociationList
  HatAr
  (FinFunctor
     (CompositionGraph Text Text) (CGMorphism Text Text) Text)
-> Map
     HatAr
     (FinFunctor
        (CompositionGraph Text Text) (CGMorphism Text Text) Text)
forall k v. AssociationList k v -> Map k v
weakMap [(HatAr
HatF, FinFunctor (CompositionGraph Text Text) (CGMorphism Text Text) Text
f), (HatAr
HatG, FinFunctor (CompositionGraph Text Text) (CGMorphism Text Text) Text
g)]}
            
    -- | An example of colimit of 'CompositionGraph's.

    exampleColimitOfCompositionGraphs :: Cocone
  Hat
  HatAr
  HatOb
  (FinCat
     (CompositionGraph (Colimit HatOb Text) (Colimit HatOb Text))
     (CGMorphism (Colimit HatOb Text) (Colimit HatOb Text))
     (Colimit HatOb Text))
  (FinFunctor
     (CompositionGraph (Colimit HatOb Text) (Colimit HatOb Text))
     (CGMorphism (Colimit HatOb Text) (Colimit HatOb Text))
     (Colimit HatOb Text))
  (CompositionGraph (Colimit HatOb Text) (Colimit HatOb Text))
exampleColimitOfCompositionGraphs = Cocone
  Hat
  HatAr
  HatOb
  (FinCat
     (CompositionGraph (Colimit HatOb Text) (Colimit HatOb Text))
     (CGMorphism (Colimit HatOb Text) (Colimit HatOb Text))
     (Colimit HatOb Text))
  (FinFunctor
     (CompositionGraph (Colimit HatOb Text) (Colimit HatOb Text))
     (CGMorphism (Colimit HatOb Text) (Colimit HatOb Text))
     (Colimit HatOb Text))
  (CompositionGraph (Colimit HatOb Text) (Colimit HatOb Text))
result
        where
            (Right CompositionGraph Text Text
cg1) = [Char]
-> Either
     (FiniteCategoryError (CGMorphism Text Text) Text)
     (CompositionGraph Text Text)
readCGString [Char]
"A -f-> B\nB -g-> C"
            (Right CompositionGraph Text Text
cg2) = [Char]
-> Either
     (FiniteCategoryError (CGMorphism Text Text) Text)
     (CompositionGraph Text Text)
readCGString [Char]
"1 -a-> 2\n 2 -b-> 3"
            (Right CompositionGraph Text Text
cg3) = [Char]
-> Either
     (FiniteCategoryError (CGMorphism Text Text) Text)
     (CompositionGraph Text Text)
readCGString [Char]
"A1 -(gof)a-> C2"
            f :: FinFunctor (CompositionGraph Text Text) (CGMorphism Text Text) Text
f = FinFunctor (CompositionGraph Text Text) (CGMorphism Text Text) Text
-> FinFunctor
     (CompositionGraph Text Text) (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 :: CompositionGraph Text Text
src = CompositionGraph Text Text
cg3, tgt :: CompositionGraph Text Text
tgt = CompositionGraph Text Text
cg1, omap :: Map Text Text
omap = AssociationList Text Text -> Map Text Text
forall k v. AssociationList k v -> Map k v
weakMap [([Char] -> Text
pack [Char]
"A1", [Char] -> Text
pack [Char]
"A"),([Char] -> Text
pack [Char]
"C2", [Char] -> Text
pack [Char]
"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
$ CompositionGraph Text Text
-> Text -> Text -> Set (CGMorphism Text Text)
forall c m o.
(Category c m o, Morphism m o) =>
c -> o -> o -> Set m
genAr CompositionGraph Text Text
cg3 ([Char] -> Text
pack [Char]
"A1") ([Char] -> Text
pack [Char]
"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
$ CompositionGraph Text Text
-> Text -> Text -> Set (CGMorphism Text Text)
forall c m o.
(Category c m o, Morphism m o) =>
c -> o -> o -> Set m
ar CompositionGraph Text Text
cg1 ([Char] -> Text
pack [Char]
"A") ([Char] -> Text
pack [Char]
"C"))]}
            g :: FinFunctor (CompositionGraph Text Text) (CGMorphism Text Text) Text
g = FinFunctor (CompositionGraph Text Text) (CGMorphism Text Text) Text
-> FinFunctor
     (CompositionGraph Text Text) (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 :: CompositionGraph Text Text
src = CompositionGraph Text Text
cg3, tgt :: CompositionGraph Text Text
tgt = CompositionGraph Text Text
cg2, omap :: Map Text Text
omap = AssociationList Text Text -> Map Text Text
forall k v. AssociationList k v -> Map k v
weakMap [([Char] -> Text
pack [Char]
"A1", [Char] -> Text
pack [Char]
"1"),([Char] -> Text
pack [Char]
"C2", [Char] -> Text
pack [Char]
"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
$ CompositionGraph Text Text
-> Text -> Text -> Set (CGMorphism Text Text)
forall c m o.
(Category c m o, Morphism m o) =>
c -> o -> o -> Set m
genAr CompositionGraph Text Text
cg3 ([Char] -> Text
pack [Char]
"A1") ([Char] -> Text
pack [Char]
"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
$ CompositionGraph Text Text
-> Text -> Text -> Set (CGMorphism Text Text)
forall c m o.
(Category c m o, Morphism m o) =>
c -> o -> o -> Set m
ar CompositionGraph Text Text
cg2 ([Char] -> Text
pack [Char]
"1") ([Char] -> Text
pack [Char]
"2"))]}
            diag :: Diagram
  Hat
  HatAr
  HatOb
  (FinCat (CompositionGraph Text Text) (CGMorphism Text Text) Text)
  (FinFunctor
     (CompositionGraph Text Text) (CGMorphism Text Text) Text)
  (CompositionGraph Text Text)
diag = Diagram
  Hat
  HatAr
  HatOb
  (FinCat (CompositionGraph Text Text) (CGMorphism Text Text) Text)
  (FinFunctor
     (CompositionGraph Text Text) (CGMorphism Text Text) Text)
  (CompositionGraph Text Text)
-> Diagram
     Hat
     HatAr
     HatOb
     (FinCat (CompositionGraph Text Text) (CGMorphism Text Text) Text)
     (FinFunctor
        (CompositionGraph Text Text) (CGMorphism Text Text) Text)
     (CompositionGraph 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 :: Hat
src = Hat
Hat, tgt :: FinCat (CompositionGraph Text Text) (CGMorphism Text Text) Text
tgt = FinCat (CompositionGraph Text Text) (CGMorphism Text Text) Text
forall c m o. FinCat c m o
FinCat, omap :: Map HatOb (CompositionGraph Text Text)
omap = AssociationList HatOb (CompositionGraph Text Text)
-> Map HatOb (CompositionGraph Text Text)
forall k v. AssociationList k v -> Map k v
weakMap [(HatOb
HatA,CompositionGraph Text Text
cg3) , (HatOb
HatB,CompositionGraph Text Text
cg2), (HatOb
HatC, CompositionGraph Text Text
cg1)], mmap :: Map
  HatAr
  (FinFunctor
     (CompositionGraph Text Text) (CGMorphism Text Text) Text)
mmap = AssociationList
  HatAr
  (FinFunctor
     (CompositionGraph Text Text) (CGMorphism Text Text) Text)
-> Map
     HatAr
     (FinFunctor
        (CompositionGraph Text Text) (CGMorphism Text Text) Text)
forall k v. AssociationList k v -> Map k v
weakMap [(HatAr
HatF, FinFunctor (CompositionGraph Text Text) (CGMorphism Text Text) Text
g), (HatAr
HatG, FinFunctor (CompositionGraph Text Text) (CGMorphism Text Text) Text
f)]}
            result :: Cocone
  Hat
  HatAr
  HatOb
  (FinCat
     (CompositionGraph (Colimit HatOb Text) (Colimit HatOb Text))
     (CGMorphism (Colimit HatOb Text) (Colimit HatOb Text))
     (Colimit HatOb Text))
  (FinFunctor
     (CompositionGraph (Colimit HatOb Text) (Colimit HatOb Text))
     (CGMorphism (Colimit HatOb Text) (Colimit HatOb Text))
     (Colimit HatOb Text))
  (CompositionGraph (Colimit HatOb Text) (Colimit HatOb Text))
result = Diagram
  Hat
  HatAr
  HatOb
  (FinCat (CompositionGraph Text Text) (CGMorphism Text Text) Text)
  (FinFunctor
     (CompositionGraph Text Text) (CGMorphism Text Text) Text)
  (CompositionGraph Text Text)
-> Cocone
     Hat
     HatAr
     HatOb
     (FinCat
        (CompositionGraph (Colimit HatOb Text) (Colimit HatOb Text))
        (CGMorphism (Colimit HatOb Text) (Colimit HatOb Text))
        (Colimit HatOb Text))
     (FinFunctor
        (CompositionGraph (Colimit HatOb Text) (Colimit HatOb Text))
        (CGMorphism (Colimit HatOb Text) (Colimit HatOb Text))
        (Colimit HatOb Text))
     (CompositionGraph (Colimit HatOb Text) (Colimit HatOb Text))
forall cIndex mIndex oIndex n e.
(FiniteCategory cIndex mIndex oIndex, Morphism mIndex oIndex,
 Eq cIndex, Eq mIndex, Eq oIndex, Eq n, Eq e) =>
Diagram
  cIndex
  mIndex
  oIndex
  (FinCat (CompositionGraph n e) (CGMorphism n e) n)
  (FinFunctor (CompositionGraph n e) (CGMorphism n e) n)
  (CompositionGraph n e)
-> Cocone
     cIndex
     mIndex
     oIndex
     (FinCat
        (CompositionGraph (Colimit oIndex n) (Colimit oIndex e))
        (CGMorphism (Colimit oIndex n) (Colimit oIndex e))
        (Colimit oIndex n))
     (FinFunctor
        (CompositionGraph (Colimit oIndex n) (Colimit oIndex e))
        (CGMorphism (Colimit oIndex n) (Colimit oIndex e))
        (Colimit oIndex n))
     (CompositionGraph (Colimit oIndex n) (Colimit oIndex e))
colimitOfCompositionGraphs Diagram
  Hat
  HatAr
  HatOb
  (FinCat (CompositionGraph Text Text) (CGMorphism Text Text) Text)
  (FinFunctor
     (CompositionGraph Text Text) (CGMorphism Text Text) Text)
  (CompositionGraph Text Text)
diag