packages feed

FiniteCategories-0.1.0.0: src/UsualCategories/One.hs

{-# 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 (Eq, Show)
    
    instance Morphism One One where
        source One = One
        target One = One
        (@) = const.const $ One
    
    instance FiniteCategory One One One where
        ob = const [One]
        identity = const.id
        ar = const.const.const $ [One]
        
    instance GeneratedFiniteCategory One One One where
        genAr = defaultGenAr
        decompose = defaultDecompose
        
    instance PrettyPrintable One where
        pprint One = "1"