git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Update docs
09bd21dGary Burgess
prelude/README.md+61−12
@@ -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
61
61
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+
62#### `Eq`
69#### `Eq`
63
70
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
72
79
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+
73#### `Monad`
89#### `Monad`
74
90
75 class (Applicative m, Bind m) <= Monad m where
91 class (Applicative m, Bind m) <= Monad m where
76
92
77#### `Num`
93#### `Num`
78
94
95+A commutative field
96+
79− class Num a where
97+ class (DivisionRing a) <= 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
86
98
87#### `Ord`
99#### `Ord`
88
100
89 class (Eq a) <= Ord a where
101 class (Eq a) <= Ord a where
90 compare :: a -> a -> Ordering
102 compare :: a -> a -> Ordering
91
103
104+#### `Ring`
105+
106+Addition, multiplication, and subtraction
107+
108+ class (Semiring a) <= Ring a where
109+ (-) :: a -> a -> a
110+
92#### `Semigroup`
111#### `Semigroup`
93
112
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
101
120
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+
102#### `Show`
131#### `Show`
103
132
104 class Show a where
133 class Show a where
@@ -131,6 +160,10 @@
131
160
132 instance categoryArr :: Category Prim.Function
161 instance categoryArr :: Category Prim.Function
133
162
163+#### `divisionRingNumber`
164+
165+ instance divisionRingNumber :: DivisionRing Number
166+
134#### `eqArray`
167#### `eqArray`
135
168
136 instance eqArray :: (Eq a) => Eq [a]
169 instance eqArray :: (Eq a) => Eq [a]
@@ -159,6 +192,10 @@
159
192
160 instance functorArr :: Functor (Prim.Function r)
193 instance functorArr :: Functor (Prim.Function r)
161
194
195+#### `moduloRingNumber`
196+
197+ instance moduloRingNumber :: ModuloRing Number
198+
162#### `monadArr`
199#### `monadArr`
163
200
164 instance monadArr :: Monad (Prim.Function r)
201 instance monadArr :: Monad (Prim.Function r)
@@ -187,6 +224,10 @@
187
224
188 instance ordUnit :: Ord Unit
225 instance ordUnit :: Ord Unit
189
226
227+#### `ringNumber`
228+
229+ instance ringNumber :: Ring Number
230+
190#### `semigroupArr`
231#### `semigroupArr`
191
232
192 instance semigroupArr :: (Semigroup s') => Semigroup (s -> s')
233 instance semigroupArr :: (Semigroup s') => Semigroup (s -> s')
@@ -203,6 +244,10 @@
203
244
204 instance semigroupoidArr :: Semigroupoid Prim.Function
245 instance semigroupoidArr :: Semigroupoid Prim.Function
205
246
247+#### `semiringNumber`
248+
249+ instance semiringNumber :: Semiring Number
250+
206#### `showArray`
251#### `showArray`
207
252
208 instance showArray :: (Show a) => Show [a]
253 instance showArray :: (Show a) => Show [a]
@@ -277,7 +322,7 @@
277#### `asTypeOf`
322#### `asTypeOf`
278
323
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.
281
326
282E.g.
327E.g.
283
328
@@ -294,13 +339,13 @@ been ambiguous, resulting in a compile-time error.
294
339
295#### `const`
340#### `const`
296
341
297−Returns its first argument and ignores its second.
342+Returns its first argument and ignores its second.
298
343
299 const :: forall a b. a -> b -> a
344 const :: forall a b. a -> b -> a
300
345
301#### `flip`
346#### `flip`
302
347
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.
304
349
305 flip :: forall a b c. (a -> b -> c) -> b -> a -> c
350 flip :: forall a b c. (a -> b -> c) -> b -> a -> c
306
351
@@ -312,13 +357,17 @@ Flips the order of the arguments to a function of two arguments.
312
357
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
314
359
360+#### `negate`
361+
362+ negate :: forall a. (Ring a) => a -> a
363+
315#### `otherwise`
364#### `otherwise`
316
365
317−An alias for `true`, which can be useful in guard clauses:
366+An alias for `true`, which can be useful in guard clauses:
318
367
319E.g.
368E.g.
320
369
321− max x y | x >= y = x
370+ max x y | x >= y = x
322 | otherwise = y
371 | otherwise = y
323
372
324 otherwise :: Boolean
373 otherwise :: Boolean