@@ -111,9 +111,6 @@ asTypeOf x _ = x
111
111
otherwise :: Boolean
112
112
otherwise = true
113
113
114
- infixr 9 >>>
115
- infixr 9 <<<
116
-
117
114
-- | A `Semigroupoid` is similar to a [`Category`](#category) but does not
118
115
-- | require an identity element `id`, just composable morphisms.
119
116
-- |
@@ -129,6 +126,10 @@ class Semigroupoid a where
129
126
instance semigroupoidFn :: Semigroupoid (-> ) where
130
127
compose f g x = f (g x)
131
128
129
+ infixr 9 >>>
130
+ infixr 9 <<<
131
+
132
+ -- | `(<<<)` is an alias for `compose`.
132
133
(<<<) :: forall a b c d . (Semigroupoid a ) => a c d -> a b c -> a b d
133
134
(<<<) = compose
134
135
@@ -150,9 +151,6 @@ class (Semigroupoid a) <= Category a where
150
151
instance categoryFn :: Category (-> ) where
151
152
id x = x
152
153
153
- infixl 4 <$>
154
- infixl 1 <#>
155
-
156
154
-- | A `Functor` is a type constructor which supports a mapping operation
157
155
-- | `(<$>)`.
158
156
-- |
@@ -175,6 +173,10 @@ instance functorArray :: Functor Array where
175
173
176
174
foreign import arrayMap :: forall a b . (a -> b ) -> Array a -> Array b
177
175
176
+ infixl 4 <$>
177
+ infixl 1 <#>
178
+
179
+ -- | `(<$>)` is an alias for `map`
178
180
(<$>) :: forall f a b . (Functor f ) => (a -> b ) -> f a -> f b
179
181
(<$>) = map
180
182
@@ -201,8 +203,6 @@ foreign import arrayMap :: forall a b. (a -> b) -> Array a -> Array b
201
203
void :: forall f a . (Functor f ) => f a -> f Unit
202
204
void fa = const unit <$> fa
203
205
204
- infixl 4 <*>
205
-
206
206
-- | The `Apply` class provides the `(<*>)` which is used to apply a function
207
207
-- | to an argument under a type constructor.
208
208
-- |
@@ -234,6 +234,9 @@ instance applyFn :: Apply ((->) r) where
234
234
instance applyArray :: Apply Array where
235
235
apply = ap
236
236
237
+ infixl 4 <*>
238
+
239
+ -- | `(<*>)` is an alias for `apply`.
237
240
(<*>) :: forall f a b . (Apply f ) => f (a -> b ) -> f a -> f b
238
241
(<*>) = apply
239
242
@@ -283,8 +286,6 @@ return = pure
283
286
liftA1 :: forall f a b . (Applicative f ) => (a -> b ) -> f a -> f b
284
287
liftA1 f a = pure f <*> a
285
288
286
- infixl 1 >>=
287
-
288
289
-- | The `Bind` type class extends the [`Apply`](#apply) type class with a
289
290
-- | "bind" operation `(>>=)` which composes computations in sequence, using
290
291
-- | the return value of one computation to determine the next computation.
@@ -322,6 +323,9 @@ instance bindArray :: Bind Array where
322
323
323
324
foreign import arrayBind :: forall a b . Array a -> (a -> Array b ) -> Array b
324
325
326
+ infixl 1 >>=
327
+
328
+ -- | `(>>=)` is an alias for `bind`.
325
329
(>>=) :: forall m a b . (Bind m ) => m a -> (a -> m b ) -> m b
326
330
(>>=) = bind
327
331
@@ -373,9 +377,6 @@ ap f a = do
373
377
a' <- a
374
378
return (f' a')
375
379
376
- infixr 5 <>
377
- infixr 5 ++
378
-
379
380
-- | The `Semigroup` type class identifies an associative operation on a type.
380
381
-- |
381
382
-- | Instances are required to satisfy the following law:
@@ -387,11 +388,14 @@ infixr 5 ++
387
388
class Semigroup a where
388
389
append :: a -> a -> a
389
390
391
+ infixr 5 <>
392
+ infixr 5 ++
393
+
390
394
-- | `(<>)` is an alias for `append`.
391
395
(<>) :: forall s . (Semigroup s ) => s -> s -> s
392
396
(<>) = append
393
397
394
- -- | `(++)` is an alias for `append`.
398
+ -- | `(++)` is an alternative alias for `append`.
395
399
(++) :: forall s . (Semigroup s ) => s -> s -> s
396
400
(++) = append
397
401
@@ -415,9 +419,6 @@ instance semigroupArray :: Semigroup (Array a) where
415
419
foreign import concatString :: String -> String -> String
416
420
foreign import concatArray :: forall a . Array a -> Array a -> Array a
417
421
418
- infixl 6 +
419
- infixl 7 *
420
-
421
422
-- | The `Semiring` class is for types that support an addition and
422
423
-- | multiplication operation.
423
424
-- |
@@ -458,6 +459,9 @@ instance semiringUnit :: Semiring Unit where
458
459
mul _ _ = unit
459
460
one = unit
460
461
462
+ infixl 6 +
463
+ infixl 7 *
464
+
461
465
-- | `(+)` is an alias for `add`.
462
466
(+) :: forall a . (Semiring a ) => a -> a -> a
463
467
(+) = add
@@ -471,8 +475,6 @@ foreign import intMul :: Int -> Int -> Int
471
475
foreign import numAdd :: Number -> Number -> Number
472
476
foreign import numMul :: Number -> Number -> Number
473
477
474
- infixl 6 -
475
-
476
478
-- | The `Ring` class is for types that support addition, multiplication,
477
479
-- | and subtraction operations.
478
480
-- |
@@ -492,6 +494,8 @@ instance ringNumber :: Ring Number where
492
494
instance ringUnit :: Ring Unit where
493
495
sub _ _ = unit
494
496
497
+ infixl 6 -
498
+
495
499
-- | `(-)` is an alias for `sub`.
496
500
(-) :: forall a . (Ring a ) => a -> a -> a
497
501
(-) = sub
@@ -503,8 +507,6 @@ negate a = zero - a
503
507
foreign import intSub :: Int -> Int -> Int
504
508
foreign import numSub :: Number -> Number -> Number
505
509
506
- infixl 7 /
507
-
508
510
-- | The `ModuloSemiring` class is for types that support addition,
509
511
-- | multiplication, division, and modulo (division remainder) operations.
510
512
-- |
@@ -528,6 +530,8 @@ instance moduloSemiringUnit :: ModuloSemiring Unit where
528
530
div _ _ = unit
529
531
mod _ _ = unit
530
532
533
+ infixl 7 /
534
+
531
535
-- | `(/)` is an alias for `div`.
532
536
(/) :: forall a . (ModuloSemiring a ) => a -> a -> a
533
537
(/) = div
@@ -561,9 +565,6 @@ class (DivisionRing a) <= Num a
561
565
instance numNumber :: Num Number
562
566
instance numUnit :: Num Unit
563
567
564
- infix 4 ==
565
- infix 4 /=
566
-
567
568
-- | The `Eq` type class represents types which support decidable equality.
568
569
-- |
569
570
-- | `Eq` instances should satisfy the following laws:
@@ -574,10 +575,15 @@ infix 4 /=
574
575
class Eq a where
575
576
eq :: a -> a -> Boolean
576
577
577
- -- | `(==)` is an alias for `eq`.
578
+ infix 4 ==
579
+ infix 4 /=
580
+
581
+ -- | `(==)` is an alias for `eq`. Tests whether one value is equal to another.
578
582
(==) :: forall a . (Eq a ) => a -> a -> Boolean
579
583
(==) = eq
580
584
585
+ -- | `(/=)` tests whether one value is _not equal_ to another. Shorthand for
586
+ -- | `not (x == y)`.
581
587
(/=) :: forall a . (Eq a ) => a -> a -> Boolean
582
588
(/=) x y = not (x == y)
583
589
@@ -793,16 +799,16 @@ instance booleanAlgebraFn :: (BooleanAlgebra b) => BooleanAlgebra (a -> b) where
793
799
disj fx fy a = fx a `disj` fy a
794
800
not fx a = not (fx a)
795
801
796
- infixr 2 ||
797
802
infixr 3 &&
803
+ infixr 2 ||
798
804
799
- -- | The `conj` operator.
800
- (||) :: forall a . (BooleanAlgebra a ) => a -> a -> a
801
- (||) = conj
802
-
803
- -- | The `disj` operator.
805
+ -- | `(&&)` is an alias for `conj`.
804
806
(&&) :: forall a . (BooleanAlgebra a ) => a -> a -> a
805
- (&&) = disj
807
+ (&&) = conj
808
+
809
+ -- | `(||)` is an alias for `disj`.
810
+ (||) :: forall a . (BooleanAlgebra a ) => a -> a -> a
811
+ (||) = disj
806
812
807
813
foreign import boolOr :: Boolean -> Boolean -> Boolean
808
814
foreign import boolAnd :: Boolean -> Boolean -> Boolean
0 commit comments