[commit: ghc] master: Mention the category laws explicitly (f762181)
git at git.haskell.org
git at git.haskell.org
Thu Aug 17 20:43:13 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/f762181ec0f48f1af9dd6d367f2a521d13988808/ghc
>---------------------------------------------------------------
commit f762181ec0f48f1af9dd6d367f2a521d13988808
Author: David Luposchainsky <dluposchainsky at gmail.com>
Date: Fri Aug 11 12:56:32 2017 +0200
Mention the category laws explicitly
>---------------------------------------------------------------
f762181ec0f48f1af9dd6d367f2a521d13988808
libraries/base/Control/Category.hs | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/libraries/base/Control/Category.hs b/libraries/base/Control/Category.hs
index ba92178..6407a6f 100644
--- a/libraries/base/Control/Category.hs
+++ b/libraries/base/Control/Category.hs
@@ -28,8 +28,13 @@ import GHC.Prim (coerce)
infixr 9 .
infixr 1 >>>, <<<
--- | A class for categories.
--- id and (.) must form a monoid.
+-- | A class for categories. Instances should satisfy the laws
+--
+-- @
+-- f '.' 'id' = f -- (right identity)
+-- 'id' '.' f = f -- (left identity)
+-- f '.' (g '.' h) = (f '.' g) '.' h -- (associativity)
+-- @
class Category cat where
-- | the identity morphism
id :: cat a a
More information about the ghc-commits
mailing list