{-# LANGUAGE MultiParamTypeClasses #-}

{-| Module  : FiniteCategories
Description : The __1__ category contains a unique object and its identity.
Copyright   : Guillaume Sabbagh 2021
License     : GPL-3
Maintainer  : guillaumesabbagh@protonmail.com
Stability   : experimental
Portability : portable

The __1__ category contains a unique object and its identity.
-}

module UsualCategories.One 
(
    One(..)
)
where
    import          FiniteCategory.FiniteCategory
    import          IO.PrettyPrint
    
    -- | A type that serves the purpose of being the __1__ category, its object and its identity.

    data One = One deriving (One -> One -> Bool
(One -> One -> Bool) -> (One -> One -> Bool) -> Eq One
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: One -> One -> Bool
$c/= :: One -> One -> Bool
== :: One -> One -> Bool
$c== :: One -> One -> Bool
Eq, Int -> One -> ShowS
[One] -> ShowS
One -> String
(Int -> One -> ShowS)
-> (One -> String) -> ([One] -> ShowS) -> Show One
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [One] -> ShowS
$cshowList :: [One] -> ShowS
show :: One -> String
$cshow :: One -> String
showsPrec :: Int -> One -> ShowS
$cshowsPrec :: Int -> One -> ShowS
Show)
    
    instance Morphism One One where
        source :: One -> One
source One
One = One
One
        target :: One -> One
target One
One = One
One
        @ :: One -> One -> One
(@) = (One -> One) -> One -> One -> One
forall a b. a -> b -> a
const((One -> One) -> One -> One -> One)
-> (One -> One -> One) -> One -> One -> One -> One
forall b c a. (b -> c) -> (a -> b) -> a -> c
.One -> One -> One
forall a b. a -> b -> a
const (One -> One -> One -> One) -> One -> One -> One -> One
forall a b. (a -> b) -> a -> b
$ One
One
    
    instance FiniteCategory One One One where
        ob :: One -> [One]
ob = [One] -> One -> [One]
forall a b. a -> b -> a
const [One
One]
        identity :: Morphism One One => One -> One -> One
identity = One -> One -> One
forall a b. a -> b -> a
const(One -> One -> One) -> (One -> One) -> One -> One -> One
forall b c a. (b -> c) -> (a -> b) -> a -> c
.One -> One
forall a. a -> a
id
        ar :: Morphism One One => One -> One -> One -> [One]
ar = (One -> One -> [One]) -> One -> One -> One -> [One]
forall a b. a -> b -> a
const((One -> One -> [One]) -> One -> One -> One -> [One])
-> ([One] -> One -> One -> [One])
-> [One]
-> One
-> One
-> One
-> [One]
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(One -> [One]) -> One -> One -> [One]
forall a b. a -> b -> a
const((One -> [One]) -> One -> One -> [One])
-> ([One] -> One -> [One]) -> [One] -> One -> One -> [One]
forall b c a. (b -> c) -> (a -> b) -> a -> c
.[One] -> One -> [One]
forall a b. a -> b -> a
const ([One] -> One -> One -> One -> [One])
-> [One] -> One -> One -> One -> [One]
forall a b. (a -> b) -> a -> b
$ [One
One]
        
    instance GeneratedFiniteCategory One One One where
        genAr :: Morphism One One => One -> One -> One -> [One]
genAr = One -> One -> One -> [One]
forall c m o.
(GeneratedFiniteCategory c m o, Morphism m o) =>
c -> o -> o -> [m]
defaultGenAr
        decompose :: Morphism One One => One -> One -> [One]
decompose = One -> One -> [One]
forall c m o.
(GeneratedFiniteCategory c m o, Morphism m o) =>
c -> m -> [m]
defaultDecompose
        
    instance PrettyPrintable One where
        pprint :: One -> String
pprint One
One = String
"1"