{-# LANGUAGE MultiParamTypeClasses #-}
module Math.FiniteCategories.Parallel
(
ParallelOb(..),
ParallelAr(..),
Parallel(..)
)
where
import Math.FiniteCategory
import Math.IO.PrettyPrint
import Data.WeakSet.Safe
data ParallelOb = ParallelA | ParallelB deriving (ParallelOb -> ParallelOb -> Bool
(ParallelOb -> ParallelOb -> Bool)
-> (ParallelOb -> ParallelOb -> Bool) -> Eq ParallelOb
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ParallelOb -> ParallelOb -> Bool
== :: ParallelOb -> ParallelOb -> Bool
$c/= :: ParallelOb -> ParallelOb -> Bool
/= :: ParallelOb -> ParallelOb -> Bool
Eq, Int -> ParallelOb -> ShowS
[ParallelOb] -> ShowS
ParallelOb -> String
(Int -> ParallelOb -> ShowS)
-> (ParallelOb -> String)
-> ([ParallelOb] -> ShowS)
-> Show ParallelOb
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ParallelOb -> ShowS
showsPrec :: Int -> ParallelOb -> ShowS
$cshow :: ParallelOb -> String
show :: ParallelOb -> String
$cshowList :: [ParallelOb] -> ShowS
showList :: [ParallelOb] -> ShowS
Show)
data ParallelAr = ParallelIdA | ParallelIdB | ParallelF | ParallelG deriving (ParallelAr -> ParallelAr -> Bool
(ParallelAr -> ParallelAr -> Bool)
-> (ParallelAr -> ParallelAr -> Bool) -> Eq ParallelAr
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ParallelAr -> ParallelAr -> Bool
== :: ParallelAr -> ParallelAr -> Bool
$c/= :: ParallelAr -> ParallelAr -> Bool
/= :: ParallelAr -> ParallelAr -> Bool
Eq, Int -> ParallelAr -> ShowS
[ParallelAr] -> ShowS
ParallelAr -> String
(Int -> ParallelAr -> ShowS)
-> (ParallelAr -> String)
-> ([ParallelAr] -> ShowS)
-> Show ParallelAr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ParallelAr -> ShowS
showsPrec :: Int -> ParallelAr -> ShowS
$cshow :: ParallelAr -> String
show :: ParallelAr -> String
$cshowList :: [ParallelAr] -> ShowS
showList :: [ParallelAr] -> ShowS
Show)
data Parallel = Parallel deriving (Parallel -> Parallel -> Bool
(Parallel -> Parallel -> Bool)
-> (Parallel -> Parallel -> Bool) -> Eq Parallel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Parallel -> Parallel -> Bool
== :: Parallel -> Parallel -> Bool
$c/= :: Parallel -> Parallel -> Bool
/= :: Parallel -> Parallel -> Bool
Eq, Int -> Parallel -> ShowS
[Parallel] -> ShowS
Parallel -> String
(Int -> Parallel -> ShowS)
-> (Parallel -> String) -> ([Parallel] -> ShowS) -> Show Parallel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Parallel -> ShowS
showsPrec :: Int -> Parallel -> ShowS
$cshow :: Parallel -> String
show :: Parallel -> String
$cshowList :: [Parallel] -> ShowS
showList :: [Parallel] -> ShowS
Show)
instance Morphism ParallelAr ParallelOb where
source :: ParallelAr -> ParallelOb
source ParallelAr
ParallelIdA = ParallelOb
ParallelA
source ParallelAr
ParallelIdB = ParallelOb
ParallelB
source ParallelAr
_ = ParallelOb
ParallelA
target :: ParallelAr -> ParallelOb
target ParallelAr
ParallelIdA = ParallelOb
ParallelA
target ParallelAr
ParallelIdB = ParallelOb
ParallelB
target ParallelAr
_ = ParallelOb
ParallelB
@? :: ParallelAr -> ParallelAr -> Maybe ParallelAr
(@?) ParallelAr
ParallelIdA ParallelAr
ParallelIdA = ParallelAr -> Maybe ParallelAr
forall a. a -> Maybe a
Just ParallelAr
ParallelIdA
(@?) ParallelAr
ParallelF ParallelAr
ParallelIdA = ParallelAr -> Maybe ParallelAr
forall a. a -> Maybe a
Just ParallelAr
ParallelF
(@?) ParallelAr
ParallelG ParallelAr
ParallelIdA = ParallelAr -> Maybe ParallelAr
forall a. a -> Maybe a
Just ParallelAr
ParallelG
(@?) ParallelAr
ParallelIdB ParallelAr
ParallelIdB = ParallelAr -> Maybe ParallelAr
forall a. a -> Maybe a
Just ParallelAr
ParallelIdB
(@?) ParallelAr
ParallelIdB ParallelAr
ParallelF = ParallelAr -> Maybe ParallelAr
forall a. a -> Maybe a
Just ParallelAr
ParallelF
(@?) ParallelAr
ParallelIdB ParallelAr
ParallelG = ParallelAr -> Maybe ParallelAr
forall a. a -> Maybe a
Just ParallelAr
ParallelG
(@?) ParallelAr
_ ParallelAr
_ = Maybe ParallelAr
forall a. Maybe a
Nothing
instance Category Parallel ParallelAr ParallelOb where
identity :: Morphism ParallelAr ParallelOb =>
Parallel -> ParallelOb -> ParallelAr
identity Parallel
_ ParallelOb
ParallelA = ParallelAr
ParallelIdA
identity Parallel
_ ParallelOb
ParallelB = ParallelAr
ParallelIdB
ar :: Morphism ParallelAr ParallelOb =>
Parallel -> ParallelOb -> ParallelOb -> Set ParallelAr
ar Parallel
_ ParallelOb
ParallelA ParallelOb
ParallelA = [ParallelAr] -> Set ParallelAr
forall a. [a] -> Set a
set [ParallelAr
ParallelIdA]
ar Parallel
_ ParallelOb
ParallelA ParallelOb
ParallelB = [ParallelAr] -> Set ParallelAr
forall a. [a] -> Set a
set [ParallelAr
ParallelF,ParallelAr
ParallelG]
ar Parallel
_ ParallelOb
ParallelB ParallelOb
ParallelB = [ParallelAr] -> Set ParallelAr
forall a. [a] -> Set a
set [ParallelAr
ParallelIdB]
ar Parallel
_ ParallelOb
_ ParallelOb
_ = [ParallelAr] -> Set ParallelAr
forall a. [a] -> Set a
set []
instance FiniteCategory Parallel ParallelAr ParallelOb where
ob :: Parallel -> Set ParallelOb
ob Parallel
_ = [ParallelOb] -> Set ParallelOb
forall a. [a] -> Set a
set [ParallelOb
ParallelA,ParallelOb
ParallelB]
instance PrettyPrint ParallelOb where
pprint :: ParallelOb -> String
pprint ParallelOb
ParallelA = String
"A"
pprint ParallelOb
ParallelB = String
"B"
instance PrettyPrint ParallelAr where
pprint :: ParallelAr -> String
pprint ParallelAr
ParallelIdA = String
"IdA"
pprint ParallelAr
ParallelIdB = String
"IdB"
pprint ParallelAr
ParallelF = String
"f"
pprint ParallelAr
ParallelG = String
"g"
instance PrettyPrint Parallel where
pprint :: Parallel -> String
pprint Parallel
Parallel = String
"Parallel"