File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ import Data.Void (Void)
10
10
-- | - Reflexivity: `x == x = true`
11
11
-- | - Symmetry: `x == y = y == x`
12
12
-- | - Transitivity: if `x == y` and `y == z` then `x == z`
13
+ -- |
14
+ -- | **Note:** The `Number` type is not an entirely law abiding member of this
15
+ -- | class due to the presence of `NaN`, since `NaN /= NaN`. Additionally,
16
+ -- | computing with `Number` can result in a loss of precision, so sometimes
17
+ -- | values that should be equivalent are not.
13
18
class Eq a where
14
19
eq :: a -> a -> Boolean
15
20
Original file line number Diff line number Diff line change @@ -17,7 +17,12 @@ import Data.Unit (Unit, unit)
17
17
-- | - Multiplication distributes over addition:
18
18
-- | - Left distributivity: `a * (b + c) = (a * b) + (a * c)`
19
19
-- | - Right distributivity: `(a + b) * c = (a * c) + (b * c)`
20
- -- | - Annihiliation: `zero * a = a * zero = zero`
20
+ -- | - Annihilation: `zero * a = a * zero = zero`
21
+ -- |
22
+ -- | **Note:** The `Number` and `Int` types are not fully law abiding
23
+ -- | members of this class hierarchy due to the potential for arithmetic
24
+ -- | overflows, and in the case of `Number`, the presence of `NaN` and
25
+ -- | `Infinity` values. The behaviour is unspecified in these cases.
21
26
class Semiring a where
22
27
add :: a -> a -> a
23
28
zero :: a
You can’t perform that action at this time.
0 commit comments