{-# LANGUAGE MultiParamTypeClasses #-}

{-| Module  : FiniteCategories
Description : The V category contains two arrows pointing to the same object.
Copyright   : Guillaume Sabbagh 2021
License     : GPL-3
Maintainer  : guillaumesabbagh@protonmail.com
Stability   : experimental
Portability : portable

The V category contains two arrows pointing to the same object.
-}

module UsualCategories.V 
(
    VOb(..),
    VAr(..),
    V(..)
)
where
    import          FiniteCategory.FiniteCategory
    import          IO.PrettyPrint
    
    -- | Object of the V category.

    data VOb = A | B | C deriving (VOb -> VOb -> Bool
(VOb -> VOb -> Bool) -> (VOb -> VOb -> Bool) -> Eq VOb
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VOb -> VOb -> Bool
$c/= :: VOb -> VOb -> Bool
== :: VOb -> VOb -> Bool
$c== :: VOb -> VOb -> Bool
Eq, Int -> VOb -> ShowS
[VOb] -> ShowS
VOb -> String
(Int -> VOb -> ShowS)
-> (VOb -> String) -> ([VOb] -> ShowS) -> Show VOb
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VOb] -> ShowS
$cshowList :: [VOb] -> ShowS
show :: VOb -> String
$cshow :: VOb -> String
showsPrec :: Int -> VOb -> ShowS
$cshowsPrec :: Int -> VOb -> ShowS
Show)
    
    -- | Morphism of the V category.

    data VAr = IdA | IdB | IdC | F | G deriving (VAr -> VAr -> Bool
(VAr -> VAr -> Bool) -> (VAr -> VAr -> Bool) -> Eq VAr
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VAr -> VAr -> Bool
$c/= :: VAr -> VAr -> Bool
== :: VAr -> VAr -> Bool
$c== :: VAr -> VAr -> Bool
Eq, Int -> VAr -> ShowS
[VAr] -> ShowS
VAr -> String
(Int -> VAr -> ShowS)
-> (VAr -> String) -> ([VAr] -> ShowS) -> Show VAr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VAr] -> ShowS
$cshowList :: [VAr] -> ShowS
show :: VAr -> String
$cshow :: VAr -> String
showsPrec :: Int -> VAr -> ShowS
$cshowsPrec :: Int -> VAr -> ShowS
Show)
    
    -- | The V category.

    data V = V deriving (V -> V -> Bool
(V -> V -> Bool) -> (V -> V -> Bool) -> Eq V
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: V -> V -> Bool
$c/= :: V -> V -> Bool
== :: V -> V -> Bool
$c== :: V -> V -> Bool
Eq, Int -> V -> ShowS
[V] -> ShowS
V -> String
(Int -> V -> ShowS) -> (V -> String) -> ([V] -> ShowS) -> Show V
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [V] -> ShowS
$cshowList :: [V] -> ShowS
show :: V -> String
$cshow :: V -> String
showsPrec :: Int -> V -> ShowS
$cshowsPrec :: Int -> V -> ShowS
Show)
    
    instance Morphism VAr VOb where
        source :: VAr -> VOb
source VAr
IdA = VOb
A
        source VAr
IdB = VOb
B
        source VAr
IdC = VOb
C
        source VAr
F = VOb
A
        source VAr
G = VOb
B
        target :: VAr -> VOb
target VAr
IdA = VOb
A
        target VAr
IdB = VOb
B
        target VAr
IdC = VOb
C
        target VAr
_ = VOb
C
        @ :: VAr -> VAr -> VAr
(@) VAr
IdA VAr
IdA = VAr
IdA
        (@) VAr
F VAr
IdA = VAr
F
        (@) VAr
IdB VAr
IdB = VAr
IdB
        (@) VAr
G VAr
IdB = VAr
G
        (@) VAr
IdC VAr
F = VAr
F
        (@) VAr
IdC VAr
G = VAr
G
        (@) VAr
IdC VAr
IdC = VAr
IdC
    
    instance FiniteCategory V VAr VOb where
        ob :: V -> [VOb]
ob = [VOb] -> V -> [VOb]
forall a b. a -> b -> a
const [VOb
A,VOb
B,VOb
C]
        identity :: Morphism VAr VOb => V -> VOb -> VAr
identity V
_ VOb
A = VAr
IdA
        identity V
_ VOb
B = VAr
IdB
        identity V
_ VOb
C = VAr
IdC
        ar :: Morphism VAr VOb => V -> VOb -> VOb -> [VAr]
ar V
_ VOb
A VOb
A = [VAr
IdA]
        ar V
_ VOb
A VOb
C = [VAr
F]
        ar V
_ VOb
B VOb
B = [VAr
IdB]
        ar V
_ VOb
B VOb
C = [VAr
G]
        ar V
_ VOb
C VOb
C = [VAr
IdC]
        ar V
_ VOb
_ VOb
_ = []
        
    instance GeneratedFiniteCategory V VAr VOb where
        genAr :: Morphism VAr VOb => V -> VOb -> VOb -> [VAr]
genAr = V -> VOb -> VOb -> [VAr]
forall c m o.
(GeneratedFiniteCategory c m o, Morphism m o) =>
c -> o -> o -> [m]
defaultGenAr
        decompose :: Morphism VAr VOb => V -> VAr -> [VAr]
decompose = V -> VAr -> [VAr]
forall c m o.
(GeneratedFiniteCategory c m o, Morphism m o) =>
c -> m -> [m]
defaultDecompose
        
    instance PrettyPrintable VOb where
        pprint :: VOb -> String
pprint = VOb -> String
forall a. Show a => a -> String
show
        
    instance PrettyPrintable VAr where
        pprint :: VAr -> String
pprint = VAr -> String
forall a. Show a => a -> String
show
    
    instance PrettyPrintable V where
        pprint :: V -> String
pprint = V -> String
forall a. Show a => a -> String
show