5959 class (Semigroupoid a) <= Category a where
6060 id :: forall t. a t t
6161
62+ #### ` DivisionRing `
63+
64+ Ring where every nonzero element has a multiplicative inverse (possibly
65+ a non-commutative field) so that ``` a `mod` b = zero ```
66+
67+ class (ModuloRing a) <= DivisionRing a where
68+
6269#### ` Eq `
6370
6471 class Eq a where
7077 class Functor f where
7178 (<$>) :: forall a b. (a -> b) -> f a -> f b
7279
80+ #### ` ModuloRing `
81+
82+ Ring with modulo operation and division where
83+ ``` a / b * b + (a `mod` b) = a ```
84+
85+ class (Ring a) <= ModuloRing a where
86+ (/) :: a -> a -> a
87+ mod :: a -> a -> a
88+
7389#### ` Monad `
7490
7591 class (Applicative m, Bind m) <= Monad m where
7692
7793#### ` Num `
7894
79- class Num a where
80- (+) :: a -> a -> a
81- (-) :: a -> a -> a
82- (*) :: a -> a -> a
83- (/) :: a -> a -> a
84- (%) :: a -> a -> a
85- negate :: a -> a
95+ A commutative field
96+
97+ class (DivisionRing a) <= Num a where
8698
8799#### ` Ord `
88100
89101 class (Eq a) <= Ord a where
90102 compare :: a -> a -> Ordering
91103
104+ #### ` Ring `
105+
106+ Addition, multiplication, and subtraction
107+
108+ class (Semiring a) <= Ring a where
109+ (-) :: a -> a -> a
110+
92111#### ` Semigroup `
93112
94113 class Semigroup a where
99118 class Semigroupoid a where
100119 (<<<) :: forall b c d. a c d -> a b c -> a b d
101120
121+ #### ` Semiring `
122+
123+ Addition and multiplication
124+
125+ class Semiring a where
126+ (+) :: a -> a -> a
127+ zero :: a
128+ (*) :: a -> a -> a
129+ one :: a
130+
102131#### ` Show `
103132
104133 class Show a where
131160
132161 instance categoryArr :: Category Prim.Function
133162
163+ #### ` divisionRingNumber `
164+
165+ instance divisionRingNumber :: DivisionRing Number
166+
134167#### ` eqArray `
135168
136169 instance eqArray :: (Eq a) => Eq [a]
159192
160193 instance functorArr :: Functor (Prim.Function r)
161194
195+ #### ` moduloRingNumber `
196+
197+ instance moduloRingNumber :: ModuloRing Number
198+
162199#### ` monadArr `
163200
164201 instance monadArr :: Monad (Prim.Function r)
187224
188225 instance ordUnit :: Ord Unit
189226
227+ #### ` ringNumber `
228+
229+ instance ringNumber :: Ring Number
230+
190231#### ` semigroupArr `
191232
192233 instance semigroupArr :: (Semigroup s') => Semigroup (s -> s')
203244
204245 instance semigroupoidArr :: Semigroupoid Prim.Function
205246
247+ #### ` semiringNumber `
248+
249+ instance semiringNumber :: Semiring Number
250+
206251#### ` showArray `
207252
208253 instance showArray :: (Show a) => Show [a]
277322#### ` asTypeOf `
278323
279324This 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.
281326
282327E.g.
283328
@@ -294,13 +339,13 @@ been ambiguous, resulting in a compile-time error.
294339
295340#### ` const `
296341
297- Returns its first argument and ignores its second.
342+ Returns its first argument and ignores its second.
298343
299344 const :: forall a b. a -> b -> a
300345
301346#### ` flip `
302347
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.
304349
305350 flip :: forall a b c. (a -> b -> c) -> b -> a -> c
306351
@@ -312,13 +357,17 @@ Flips the order of the arguments to a function of two arguments.
312357
313358 liftM1 :: forall m a b. (Monad m) => (a -> b) -> m a -> m b
314359
360+ #### ` negate `
361+
362+ negate :: forall a. (Ring a) => a -> a
363+
315364#### ` otherwise `
316365
317- An alias for ` true ` , which can be useful in guard clauses:
366+ An alias for ` true ` , which can be useful in guard clauses:
318367
319368E.g.
320369
321- max x y | x >= y = x
370+ max x y | x >= y = x
322371 | otherwise = y
323372
324373 otherwise :: Boolean
0 commit comments