packages feed

FiniteCategories-0.1.0.0: src/UsualCategories/Zero.hs

{-# LANGUAGE MultiParamTypeClasses #-}

{-| Module  : FiniteCategories
Description : The __0__ category contains no object and no morphism.
Copyright   : Guillaume Sabbagh 2021
License     : GPL-3
Maintainer  : guillaumesabbagh@protonmail.com
Stability   : experimental
Portability : portable

The __0__ category contains no object and no morphism.
-}

module UsualCategories.Zero 
(
    Zero(..)
)
where
    import          FiniteCategory.FiniteCategory
    import          IO.PrettyPrint
    
    -- | The __0__ category.
    data Zero = Zero deriving (Eq, Show)
    
    instance Morphism Zero Zero where
        source _ = error "No morphism in the zero category."
        target _ = error "No morphism in the zero category."
        (@) _ _ = error "No morphism in the zero category."
    
    instance FiniteCategory Zero Zero Zero where
        ob = const []
        identity _ _ = error "No object in the zero category."
        ar = const.const.const $ []
        
    instance GeneratedFiniteCategory Zero Zero Zero where
        genAr = ar
        decompose _ _ = error "No morphism in the zero category."
        
    instance PrettyPrintable Zero where
        pprint = show