summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Luposchainsky <dluposchainsky@gmail.com>2017-08-11 12:56:32 +0200
committerBen Gamari <ben@smart-cactus.org>2017-08-17 16:42:55 -0400
commitf762181ec0f48f1af9dd6d367f2a521d13988808 (patch)
tree26c15b193144c88375fccd3f875fb9380ed92b5e
parent63397cb3c51c4871990d120b2eaeba2f82729481 (diff)
downloadhaskell-f762181ec0f48f1af9dd6d367f2a521d13988808.tar.gz
Mention the category laws explicitly
-rw-r--r--libraries/base/Control/Category.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/libraries/base/Control/Category.hs b/libraries/base/Control/Category.hs
index ba92178bae..6407a6f509 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