{-# LANGUAGE Trustworthy #-}{-# LANGUAGE GADTs #-}{-# LANGUAGE NoImplicitPrelude #-}{-# LANGUAGE PolyKinds #-}{-# OPTIONS_GHC -Wno-inline-rule-shadowing #-}-- The RULES for the methods of class Category may never fire-- e.g. identity/left, identity/right, association; see #10528------------------------------------------------------------------------------- |-- Module : Control.Category-- Copyright : (c) Ashley Yakeley 2007-- License : BSD-style (see the LICENSE file in the distribution)---- Maintainer : ashley@semantic.org-- Stability : experimental-- Portability : portable-- https://gitlab.haskell.org/ghc/ghc/issues/1773moduleControl.CategorywhereimportqualifiedGHC.Base (id ,(.) )importData.Type.Coercion importData.Type.Equality importData.Coerce (coerce)infixr9. infixr1>>> ,<<< -- | A class for categories. Instances should satisfy the laws---- [Right identity] @f '.' 'id' = f@-- [Left identity] @'id' '.' f = f@-- [Associativity] @f '.' (g '.' h) = (f '.' g) '.' h@--classCategory cat where-- | the identity morphismid ::cat a a -- | morphism composition(.) ::cat b c ->cat a b ->cat a c {-# RULES"identity/left"forallp .id . p =p "identity/right"forallp .p . id =p "association"forallp q r .(p . q ). r =p . (q . r )#-}-- | @since 3.0instanceCategory (->)whereid :: a -> a id =a -> a forall a. a -> a GHC.Base.id . :: (b -> c) -> (a -> b) -> a -> c (.) =(b -> c) -> (a -> b) -> a -> c forall b c a. (b -> c) -> (a -> b) -> a -> c (GHC.Base..) -- | @since 4.7.0.0instanceCategory (:~:) whereid :: a :~: a id =a :~: a forall k (a :: k). a :~: a Refl b :~: c Refl . :: (b :~: c) -> (a :~: b) -> a :~: c . a :~: b Refl =a :~: c forall k (a :: k). a :~: a Refl -- | @since 4.10.0.0instanceCategory (:~~:) whereid :: a :~~: a id =a :~~: a forall k (a :: k). a :~~: a HRefl b :~~: c HRefl . :: (b :~~: c) -> (a :~~: b) -> a :~~: c . a :~~: b HRefl =a :~~: c forall k (a :: k). a :~~: a HRefl -- | @since 4.7.0.0instanceCategory Coercion whereid :: Coercion a a id =Coercion a a forall k (a :: k) (b :: k). Coercible a b => Coercion a b Coercion . :: Coercion b c -> Coercion a b -> Coercion a c (.) Coercion b c Coercion =Coercion a b -> Coercion a c coerce-- | Right-to-left composition(<<<) ::Category cat =>cat b c ->cat a b ->cat a c <<< :: cat b c -> cat a b -> cat a c (<<<) =cat b c -> cat a b -> cat a c forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c (.) -- | Left-to-right composition(>>>) ::Category cat =>cat a b ->cat b c ->cat a c cat a b f >>> :: cat a b -> cat b c -> cat a c >>> cat b c g =cat b c g cat b c -> cat a b -> cat a c forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . cat a b f