module Pandora.Pattern.Category (Category (..)) where

import Pandora.Pattern.Semigroupoid (Semigroupoid ((.))) 

infixl 2 #
infixr 0 $

{- |
> When providing a new instance, you should ensure it satisfies:
> * Left identity: identity . f ≡ f
> * Right identity: f . identity ≡ f
-}

class Semigroupoid m => Category m where
	identity :: m a a

	($) :: m (m a b) (m a b)
	($) = m (m a b) (m a b)
forall (m :: * -> * -> *) a. Category m => m a a
identity m (m a b) (m a b) -> m (m a b) (m a b) -> m (m a b) (m a b)
forall (m :: * -> * -> *) b c a.
Semigroupoid m =>
m b c -> m a b -> m a c
. m (m a b) (m a b)
forall (m :: * -> * -> *) a. Category m => m a a
identity

	(#) :: m (m a b) (m a b)
	(#) = m (m a b) (m a b)
forall (m :: * -> * -> *) a. Category m => m a a
identity m (m a b) (m a b) -> m (m a b) (m a b) -> m (m a b) (m a b)
forall (m :: * -> * -> *) b c a.
Semigroupoid m =>
m b c -> m a b -> m a c
. m (m a b) (m a b)
forall (m :: * -> * -> *) a. Category m => m a a
identity