@@ -77,8 +77,7 @@ module Prelude
7777 -- |
7878 -- | `Semigroupoid`s should obey the following rule:
7979 -- |
80− -- | Association:
81− -- | `forall p q r. p <<< (q <<< r) = (p <<< q) <<< r`
80+ -- | - Associativity: `p <<< (q <<< r) = (p <<< q) <<< r`
8281 -- |
8382 class Semigroupoid a where
8483 (<<<) :: forall b c d. a c d -> a b c -> a b d
@@ -94,11 +93,8 @@ module Prelude
9493 -- |
9594 -- | `Category`s should obey the following rules.
9695 -- |
97− -- | Left Identity:
98− -- | `forall p. id <<< p = p`
99− -- |
100− -- | Right Identity:
101− -- | `forall p. p <<< id = p`
96+ -- | - Left Identity: `id <<< p = p`
97+ -- | - Right Identity: `p <<< id = p`
10298 -- |
10399 class (Semigroupoid a) <= Category a where
104100 id :: forall t. a t t
@@ -219,11 +215,8 @@ module Prelude
219215 -- |
220216 -- | `Functor`s should obey the following rules.
221217 -- |
222− -- | Identity:
223− -- | `(<$>) id = id`
224− -- |
225− -- | Composition:
226− -- | `forall f g. (<$>) (f . g) = ((<$>) f) . ((<$>) g)`
218+ -- | - Identity: `(<$>) id = id`
219+ -- | - Composition: `(<$>) (f <<< g) = (<$> f) <<< (<$> g)`
227220 -- |
228221 class Functor f where
229222 (<$>) :: forall a b. (a -> b) -> f a -> f b
@@ -239,10 +232,9 @@ module Prelude
239232 -- | `Apply`s are intuitively [`Applicative`](#applicative)s less `pure`, and more formally a
240233 -- | strong lax semi-monoidal endofunctor.
241234 -- |
242− -- | `Apply`s should obey the following rules.
235+ -- | `Apply`s should obey the following rule.
243236 -- |
244− -- | Associative Composition:
245− -- | `forall f g h. (.) <$> f <*> g <*> h = f <*> (g <*> h)`
237+ -- | - Associative Composition: `(<<<) <$> f <*> g <*> h = f <*> (g <*> h)`
246238 -- |
247239 class (Functor f) <= Apply f where
248240 (<*>) :: forall a b. f (a -> b) -> f a -> f b
@@ -252,17 +244,10 @@ module Prelude
252244 -- |
253245 -- | `Applicative`s should obey the following rules.
254246 -- |
255− -- | Identity:
256− -- | `forall v. (pure id) <*> v = v`
257− -- |
258− -- | Composition:
259− -- | `forall f g h. (pure (.)) <*> f <*> g <*> h = f <*> (g <*> h)`
260− -- |
261− -- | Homomorphism:
262− -- | `forall f x. (pure f) <*> (pure x) = pure (f x)`
263− -- |
264− -- | Interchange:
265− -- | `forall u y. u <*> (pure y) = (pure (($) y)) <*> u`
247+ -- | - Identity: `(pure id) <*> v = v`
248+ -- | - Composition: `(pure <<<) <*> f <*> g <*> h = f <*> (g <*> h)`
249+ -- | - Homomorphism: `(pure f) <*> (pure x) = pure (f x)`
250+ -- | - Interchange: `u <*> (pure y) = (pure ($ y)) <*> u`
266251 -- |
267252 class (Apply f) <= Applicative f where
268253 pure :: forall a. a -> f a
@@ -276,8 +261,7 @@ module Prelude
276261 -- |
277262 -- | `Bind`s should obey the following rule.
278263 -- |
279− -- | Associativity:
280− -- | `forall f g x. (x >>= f) >>= g = x >>= (\k => f k >>= g)`
264+ -- | - Associativity: `forall f g x. (x >>= f) >>= g = x >>= (\k => f k >>= g)`
281265 -- |
282266 class (Apply m) <= Bind m where
283267 (>>=) :: forall a b. m a -> (a -> m b) -> m b
@@ -287,11 +271,8 @@ module Prelude
287271 -- |
288272 -- | `Monad`s should obey the following rules.
289273 -- |
290− -- | Left Identity:
291− -- | `forall f x. pure x >>= f = f x`
292− -- |
293− -- | Right Identity:
294− -- | `forall x. x >>= pure = x`
274+ -- | - Left Identity: `pure x >>= f = f x`
275+ -- | - Right Identity: `x >>= pure = x`
295276 -- |
296277 class (Applicative m, Bind m) <= Monad m
297278
@@ -330,28 +311,43 @@ module Prelude
330311 infixl 6 -
331312 infixl 6 +
332313
333− -- | Addition and multiplication
314+ -- | Addition and multiplication, satisfying the following laws:
315+ -- |
316+ -- | - `a` is a commutative monoid under addition
317+ -- | - `a` is a monoid under multiplication
318+ -- | - multiplication distributes over addition
319+ -- | - multiplication by `zero` annihilates `a`
320+ -- |
334321 class Semiring a where
335322 (+) :: a -> a -> a
336323 zero :: a
337324 (*) :: a -> a -> a
338325 one :: a
339326
340− -- | Semiring with modulo operation and division where
341− -- | ```a / b * b + (a `mod` b) = a```
327+ -- | Addition, multiplication, modulo operation and division, satisfying:
328+ -- |
329+ -- | - ```a / b * b + (a `mod` b) = a```
330+ -- |
342331 class (Semiring a) <= ModuloSemiring a where
343332 (/) :: a -> a -> a
344333 mod :: a -> a -> a
345334
346− -- | Addition, multiplication, and subtraction
335+ -- | Addition, multiplication, and subtraction.
336+ -- |
337+ -- | Has the same laws as `Semiring` but additionally satisfying:
338+ -- |
339+ -- | - `a` is an abelian group under addition
340+ -- |
347341 class (Semiring a) <= Ring a where
348342 (-) :: a -> a -> a
349343
350344 negate :: forall a. (Ring a) => a -> a
351345 negate a = zero - a
352346
353− -- | Ring where every nonzero element has a multiplicative inverse (possibly
354− -- | a non-commutative field) so that ```a `mod` b = zero```
347+ -- | Ring where every nonzero element has a multiplicative inverse so that:
348+ -- |
349+ -- | - ```a `mod` b = zero```
350+ -- |
355351 class (Ring a, ModuloSemiring a) <= DivisionRing a
356352
357353 -- | A commutative field
@@ -429,6 +425,7 @@ module Prelude
429425 infix 4 ==
430426 infix 4 /=
431427
428+ -- | Class for types that have an equality comparison.
432429 class Eq a where
433430 (==) :: a -> a -> Boolean
434431 (/=) :: a -> a -> Boolean
@@ -505,7 +502,14 @@ module Prelude
505502 (<>) GT _ = GT
506503 (<>) EQ y = y
507504
508−
505+ -- | Class for types that have ordered comparisons.
506+ -- |
507+ -- | Represents a partially ordered set satisfying the following laws:
508+ -- |
509+ -- | - Reflexivity: `a <= a`
510+ -- | - Antisymmetry: if `a <= b` and `b <= a` then `a = b`
511+ -- | - Transitivity: if `a <= b` and `b <= c` then `a <= c`
512+ -- |
509513 class (Eq a) <= Ord a where
510514 compare :: a -> a -> Ordering
511515