git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Remove 'forall's in laws, document 'cons'.
commit8ebc6179005dfb27300c329c50db9c296cf7aa5f authorPhil Freeman <paf31@cantab.net> dateMon 2 Mar 2015, 13:17 (12 years ago) parent1371017
2 files changed+28−18
prelude/README.md+14−9 prelude/prelude.purs+14−9
prelude/README.md+14−9
@@ -163,11 +163,9 @@ length (groupBy productCategory (filter isInStock (products)))
163163(:) :: forall a. a -> [a] -> [a]
164164```
165165
166−Attaches an element to the front of an array, creating a new array.
166+An infix alias for `cons`.
167167
168−```purescript
169−1 : [2, 3, 4] = [1, 2, 3, 4]
170−```
168+Note, the running time of this function is `O(n)`.
171169
172170#### `cons`
173171
@@ -175,6 +173,13 @@ Attaches an element to the front of an array, creating a new array.
175173cons :: forall a. a -> [a] -> [a]
176174```
177175
176+Attaches an element to the front of an array, creating a new array.
177+
178+```purescript
179+cons 1 [2, 3, 4] = [1, 2, 3, 4]
180+```
181+
182+Note, the running time of this function is `O(n)`.
178183
179184#### `Show`
180185
@@ -355,7 +360,7 @@ where the function argument of `f` is given the name `y`.
355360
356361`Bind` instances should satisfy the following law:
357362
358−- Associativity: `forall f g x. (x >>= f) >>= g = x >>= (\k => f k >>= g)`
363+- Associativity: `(x >>= f) >>= g = x >>= (\k => f k >>= g)`
359364
360365Or, expressed using `do` notation:
361366
@@ -602,10 +607,10 @@ The `Eq` type class represents types which support decidable equality.
602607
603608`Eq` instances should satisfy the following laws:
604609
605−- Reflexivity: `forall x. x == x = true`
606−- Symmetry: `forall x y. x == y = y == x`
610+- Reflexivity: `x == x = true`
611+- Symmetry: `x == y = y == x`
607612- Transitivity: if `x == y` and `y == z` then `x == z`
608−- Negation: `forall x y. x /= y = not (x == y)`
613+- Negation: `x /= y = not (x == y)`
609614
610615`(/=)` may be implemented in terms of `(==)`, but it might give a performance improvement to implement it separately.
611616
@@ -831,7 +836,7 @@ The `Semigroup` type class identifies an associative operation on a type.
831836
832837`Semigroup` instances are required to satisfy the following law:
833838
834−- Associativity: `forall x y z. (x <> y) <> z = x <> (y <> z)`
839+- Associativity: `(x <> y) <> z = x <> (y <> z)`
835840
836841For example, the `String` type is an instance of `Semigroup`, where `(<>)` is defined to be string concatenation.
837842
prelude/prelude.purs+14−9
@@ -146,14 +146,19 @@ module Prelude
146146
147147 infixr 6 :
148148
149− -- | Attaches an element to the front of an array, creating a new array.
149+ -- | An infix alias for `cons`.
150150 -- |
151− -- | ```purescript
152− -- | 1 : [2, 3, 4] = [1, 2, 3, 4]
153− -- | ```
151+ -- | Note, the running time of this function is `O(n)`.
154152 (:) :: forall a. a -> [a] -> [a]
155153 (:) = cons
156154
155+ -- | Attaches an element to the front of an array, creating a new array.
156+ -- |
157+ -- | ```purescript
158+ -- | cons 1 [2, 3, 4] = [1, 2, 3, 4]
159+ -- | ```
160+ -- |
161+ -- | Note, the running time of this function is `O(n)`.
157162 foreign import cons
158163 """
159164 function cons(e) {
@@ -318,7 +323,7 @@ module Prelude
318323 -- |
319324 -- | `Bind` instances should satisfy the following law:
320325 -- |
321− -- | - Associativity: `forall f g x. (x >>= f) >>= g = x >>= (\k => f k >>= g)`
326+ -- | - Associativity: `(x >>= f) >>= g = x >>= (\k => f k >>= g)`
322327 -- |
323328 -- | Or, expressed using `do` notation:
324329 -- |
@@ -526,10 +531,10 @@ module Prelude
526531 -- |
527532 -- | `Eq` instances should satisfy the following laws:
528533 -- |
529− -- | - Reflexivity: `forall x. x == x = true`
530− -- | - Symmetry: `forall x y. x == y = y == x`
534+ -- | - Reflexivity: `x == x = true`
535+ -- | - Symmetry: `x == y = y == x`
531536 -- | - Transitivity: if `x == y` and `y == z` then `x == z`
532− -- | - Negation: `forall x y. x /= y = not (x == y)`
537+ -- | - Negation: `x /= y = not (x == y)`
533538 -- |
534539 -- | `(/=)` may be implemented in terms of `(==)`, but it might give a performance improvement to implement it separately.
535540 class Eq a where
@@ -829,7 +834,7 @@ module Prelude
829834 -- |
830835 -- | `Semigroup` instances are required to satisfy the following law:
831836 -- |
832− -- | - Associativity: `forall x y z. (x <> y) <> z = x <> (y <> z)`
837+ -- | - Associativity: `(x <> y) <> z = x <> (y <> z)`
833838 -- |
834839 -- | For example, the `String` type is an instance of `Semigroup`, where `(<>)` is defined to be string concatenation.
835840 class Semigroup a where