@@ -59,6 +59,13 @@
59 class (Semigroupoid a) <= Category a where
59 class (Semigroupoid a) <= Category a where
60 id :: forall t. a t t
60 id :: forall t. a t t
64+Ring where every nonzero element has a multiplicative inverse (possibly
65+a non-commutative field) so that ```a `mod` b = zero```
67+ class (ModuloRing a) <= DivisionRing a where
64 class Eq a where
71 class Eq a where
@@ -70,25 +77,37 @@
70 class Functor f where
77 class Functor f where
71 (<$>) :: forall a b. (a -> b) -> f a -> f b
78 (<$>) :: forall a b. (a -> b) -> f a -> f b
82+Ring with modulo operation and division where
83+```a / b * b + (a `mod` b) = a```
85+ class (Ring a) <= ModuloRing a where
73#### `Monad`
89#### `Monad`
75 class (Applicative m, Bind m) <= Monad m where
91 class (Applicative m, Bind m) <= Monad m where
79− class Num a where
97+ class (DivisionRing a) <= Num a where
89 class (Eq a) <= Ord a where
101 class (Eq a) <= Ord a where
90 compare :: a -> a -> Ordering
102 compare :: a -> a -> Ordering
106+Addition, multiplication, and subtraction
108+ class (Semiring a) <= Ring a where
92#### `Semigroup`
111#### `Semigroup`
94 class Semigroup a where
113 class Semigroup a where
@@ -99,6 +118,16 @@
99 class Semigroupoid a where
118 class Semigroupoid a where
100 (<<<) :: forall b c d. a c d -> a b c -> a b d
119 (<<<) :: forall b c d. a c d -> a b c -> a b d
123+Addition and multiplication
125+ class Semiring a where
102#### `Show`
131#### `Show`
104 class Show a where
133 class Show a where
@@ -131,6 +160,10 @@
132 instance categoryArr :: Category Prim.Function
161 instance categoryArr :: Category Prim.Function
163+#### `divisionRingNumber`
165+ instance divisionRingNumber :: DivisionRing Number
134#### `eqArray`
167#### `eqArray`
136 instance eqArray :: (Eq a) => Eq [a]
169 instance eqArray :: (Eq a) => Eq [a]
@@ -159,6 +192,10 @@
160 instance functorArr :: Functor (Prim.Function r)
193 instance functorArr :: Functor (Prim.Function r)
195+#### `moduloRingNumber`
197+ instance moduloRingNumber :: ModuloRing Number
162#### `monadArr`
199#### `monadArr`
164 instance monadArr :: Monad (Prim.Function r)
201 instance monadArr :: Monad (Prim.Function r)
@@ -187,6 +224,10 @@
188 instance ordUnit :: Ord Unit
225 instance ordUnit :: Ord Unit
229+ instance ringNumber :: Ring Number
190#### `semigroupArr`
231#### `semigroupArr`
192 instance semigroupArr :: (Semigroup s') => Semigroup (s -> s')
233 instance semigroupArr :: (Semigroup s') => Semigroup (s -> s')
@@ -203,6 +244,10 @@
204 instance semigroupoidArr :: Semigroupoid Prim.Function
245 instance semigroupoidArr :: Semigroupoid Prim.Function
247+#### `semiringNumber`
249+ instance semiringNumber :: Semiring Number
206#### `showArray`
251#### `showArray`
208 instance showArray :: (Show a) => Show [a]
253 instance showArray :: (Show a) => Show [a]
@@ -277,7 +322,7 @@
277#### `asTypeOf`
322#### `asTypeOf`
279This function returns its first argument, and can be used to assert type equalities.
324This function returns its first argument, and can be used to assert type equalities.
280−This can be useful when types are otherwise ambiguous.
325+This can be useful when types are otherwise ambiguous.
@@ -294,13 +339,13 @@ been ambiguous, resulting in a compile-time error.
295#### `const`
340#### `const`
297−Returns its first argument and ignores its second.
342+Returns its first argument and ignores its second.
299 const :: forall a b. a -> b -> a
344 const :: forall a b. a -> b -> a
301#### `flip`
346#### `flip`
303−Flips the order of the arguments to a function of two arguments.
348+Flips the order of the arguments to a function of two arguments.
305 flip :: forall a b c. (a -> b -> c) -> b -> a -> c
350 flip :: forall a b c. (a -> b -> c) -> b -> a -> c
@@ -312,13 +357,17 @@ Flips the order of the arguments to a function of two arguments.
313 liftM1 :: forall m a b. (Monad m) => (a -> b) -> m a -> m b
358 liftM1 :: forall m a b. (Monad m) => (a -> b) -> m a -> m b
362+ negate :: forall a. (Ring a) => a -> a
315#### `otherwise`
364#### `otherwise`
317−An alias for `true`, which can be useful in guard clauses:
366+An alias for `true`, which can be useful in guard clauses:
321− max x y | x >= y = x
370+ max x y | x >= y = x
322 | otherwise = y
371 | otherwise = y
324 otherwise :: Boolean
373 otherwise :: Boolean