FiniteCategories-0.1.0.0: src/UsualCategories/V.hs
{-# 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 (Eq, Show)
-- | Morphism of the V category.
data VAr = IdA | IdB | IdC | F | G deriving (Eq, Show)
-- | The V category.
data V = V deriving (Eq, Show)
instance Morphism VAr VOb where
source IdA = A
source IdB = B
source IdC = C
source F = A
source G = B
target IdA = A
target IdB = B
target IdC = C
target _ = C
(@) IdA IdA = IdA
(@) F IdA = F
(@) IdB IdB = IdB
(@) G IdB = G
(@) IdC F = F
(@) IdC G = G
(@) IdC IdC = IdC
instance FiniteCategory V VAr VOb where
ob = const [A,B,C]
identity _ A = IdA
identity _ B = IdB
identity _ C = IdC
ar _ A A = [IdA]
ar _ A C = [F]
ar _ B B = [IdB]
ar _ B C = [G]
ar _ C C = [IdC]
ar _ _ _ = []
instance GeneratedFiniteCategory V VAr VOb where
genAr = defaultGenAr
decompose = defaultDecompose
instance PrettyPrintable VOb where
pprint = show
instance PrettyPrintable VAr where
pprint = show
instance PrettyPrintable V where
pprint = show