git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
fixed indentation and two examples
a9c5bd9JP Smith
prelude/README.md+14−14
@@ -13,8 +13,8 @@ otherwise :: Boolean
13An alias for `true`, which can be useful in guard clauses:
13An alias for `true`, which can be useful in guard clauses:
14
14
15```purescript
15```purescript
16− max x y | x >= y = x
16+max x y | x >= y = x
17− | otherwise = y
17+ | otherwise = y
18```
18```
19
19
20
20
@@ -27,7 +27,7 @@ flip :: forall a b c. (a -> b -> c) -> b -> a -> c
27Flips the order of the arguments to a function of two arguments.
27Flips the order of the arguments to a function of two arguments.
28
28
29```purescript
29```purescript
30− flip const 1 2 = const 2 1 = 2
30+flip const 1 2 = const 2 1 = 2
31```
31```
32
32
33
33
@@ -40,7 +40,7 @@ const :: forall a b. a -> b -> a
40Returns its first argument and ignores its second.
40Returns its first argument and ignores its second.
41
41
42```purescript
42```purescript
43− const 1 "hello" = 1
43+const 1 "hello" = 1
44```
44```
45
45
46
46
@@ -54,7 +54,7 @@ This function returns its first argument, and can be used to assert type equalit
54This can be useful when types are otherwise ambiguous.
54This can be useful when types are otherwise ambiguous.
55
55
56```purescript
56```purescript
57− main = print $ [] `asTypeOf` [0]
57+main = print $ [] `asTypeOf` [0]
58```
58```
59
59
60If instead, we had written `main = print []`, the type of the argument `[]` would have
60If instead, we had written `main = print []`, the type of the argument `[]` would have
@@ -125,12 +125,12 @@ instance categoryArr :: Category Prim.Function
125Applies a function to its argument
125Applies a function to its argument
126
126
127```purescript
127```purescript
128− (+) 1 ((*) 2 (const 1 2)) = (+) 1 $ (*) 2 $ const 1 2
128+length $ groupBy productCategory $ filter isInStock products =
129+length (groupby productcategory (filter isinstock (products)))
129```
130```
130
131
131−`($)` is different from [`(#)`](#-2) because it is right-infix instead of left. Right-infix
132+`($)` is different from [`(#)`](#-2) because it is right-infix instead of left, so
132−operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators parse like
133−`(((a # b) # c) # d ...)`.
133+`a $ b $ c $ d x` = `a (b (c (d x)))`
134
134
135
135
136#### `(#)`
136#### `(#)`
@@ -142,12 +142,12 @@ operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators pars
142Applies a function to its argument
142Applies a function to its argument
143
143
144```purescript
144```purescript
145− (((3 + 1) * 2) + 4) = 3 # ((+) 1) # ((*) 2) # ((+) 4)
145+products # groupby productcategory # filter isinstock # length =
146+length (groupby productcategory (filter isinstock (products)))
146```
147```
147
148
148−`(#)` is different from [`($)`](#-1) because it is left-infix instead of right. Right-infix
149+`(#)` is different from [`($)`](#-1) because it is left-infix instead of right, so
149−operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators parse like
150−`(((a # b) # c) # d ...)`.
150+`x # a # b # c # d` = `(((x a) b) c) d`
151
151
152
152
153#### `(:)`
153#### `(:)`
@@ -159,7 +159,7 @@ operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators pars
159Attaches an element to the front of a list.
159Attaches an element to the front of a list.
160
160
161```purescript
161```purescript
162− 1 : [2, 3, 4] = [1, 2, 3, 4]
162+1 : [2, 3, 4] = [1, 2, 3, 4]
163```
163```
164
164
165
165
prelude/prelude.purs+14−14
@@ -32,8 +32,8 @@ module Prelude
32 -- | An alias for `true`, which can be useful in guard clauses:
32 -- | An alias for `true`, which can be useful in guard clauses:
33 -- |
33 -- |
34 -- | ```purescript
34 -- | ```purescript
35− -- | max x y | x >= y = x
35+ -- | max x y | x >= y = x
36− -- | | otherwise = y
36+ -- | | otherwise = y
37 -- | ```
37 -- | ```
38 -- |
38 -- |
39 otherwise :: Boolean
39 otherwise :: Boolean
@@ -42,7 +42,7 @@ module Prelude
42 -- | Flips the order of the arguments to a function of two arguments.
42 -- | Flips the order of the arguments to a function of two arguments.
43 -- |
43 -- |
44 -- | ```purescript
44 -- | ```purescript
45− -- | flip const 1 2 = const 2 1 = 2
45+ -- | flip const 1 2 = const 2 1 = 2
46 -- | ```
46 -- | ```
47 -- |
47 -- |
48 flip :: forall a b c. (a -> b -> c) -> b -> a -> c
48 flip :: forall a b c. (a -> b -> c) -> b -> a -> c
@@ -51,7 +51,7 @@ module Prelude
51 -- | Returns its first argument and ignores its second.
51 -- | Returns its first argument and ignores its second.
52 -- |
52 -- |
53 -- | ```purescript
53 -- | ```purescript
54− -- | const 1 "hello" = 1
54+ -- | const 1 "hello" = 1
55 -- | ```
55 -- | ```
56 -- |
56 -- |
57 const :: forall a b. a -> b -> a
57 const :: forall a b. a -> b -> a
@@ -61,7 +61,7 @@ module Prelude
61 -- | This can be useful when types are otherwise ambiguous.
61 -- | This can be useful when types are otherwise ambiguous.
62 -- |
62 -- |
63 -- | ```purescript
63 -- | ```purescript
64− -- | main = print $ [] `asTypeOf` [0]
64+ -- | main = print $ [] `asTypeOf` [0]
65 -- | ```
65 -- | ```
66 -- |
66 -- |
67 -- | If instead, we had written `main = print []`, the type of the argument `[]` would have
67 -- | If instead, we had written `main = print []`, the type of the argument `[]` would have
@@ -112,12 +112,12 @@ module Prelude
112 -- | Applies a function to its argument
112 -- | Applies a function to its argument
113 -- |
113 -- |
114 -- | ```purescript
114 -- | ```purescript
115− -- | (+) 1 ((*) 2 (const 1 2)) = (+) 1 $ (*) 2 $ const 1 2
115+ -- | length $ groupBy productCategory $ filter isInStock products =
116+ -- | length (groupby productcategory (filter isinstock (products)))
116 -- | ```
117 -- | ```
117 -- |
118 -- |
118− -- | `($)` is different from [`(#)`](#-2) because it is right-infix instead of left. Right-infix
119+ -- | `($)` is different from [`(#)`](#-2) because it is right-infix instead of left, so
119− -- | operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators parse like
120− -- | `(((a # b) # c) # d ...)`.
120+ -- | `a $ b $ c $ d x` = `a (b (c (d x)))`
121 -- |
121 -- |
122 ($) :: forall a b. (a -> b) -> a -> b
122 ($) :: forall a b. (a -> b) -> a -> b
123 ($) f x = f x
123 ($) f x = f x
@@ -125,12 +125,12 @@ module Prelude
125 -- | Applies a function to its argument
125 -- | Applies a function to its argument
126 -- |
126 -- |
127 -- | ```purescript
127 -- | ```purescript
128− -- | (((3 + 1) * 2) + 4) = 3 # ((+) 1) # ((*) 2) # ((+) 4)
128+ -- | products # groupby productcategory # filter isinstock # length =
129+ -- | length (groupby productcategory (filter isinstock (products)))
129 -- | ```
130 -- | ```
130 -- |
131 -- |
131− -- | `(#)` is different from [`($)`](#-1) because it is left-infix instead of right. Right-infix
132+ -- | `(#)` is different from [`($)`](#-1) because it is left-infix instead of right, so
132− -- | operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators parse like
133− -- | `(((a # b) # c) # d ...)`.
133+ -- | `x # a # b # c # d` = `(((x a) b) c) d`
134 -- |
134 -- |
135 (#) :: forall a b. a -> (a -> b) -> b
135 (#) :: forall a b. a -> (a -> b) -> b
136 (#) x f = f x
136 (#) x f = f x
@@ -140,7 +140,7 @@ module Prelude
140 -- | Attaches an element to the front of a list.
140 -- | Attaches an element to the front of a list.
141 -- |
141 -- |
142 -- | ```purescript
142 -- | ```purescript
143− -- | 1 : [2, 3, 4] = [1, 2, 3, 4]
143+ -- | 1 : [2, 3, 4] = [1, 2, 3, 4]
144 -- | ```
144 -- | ```
145 -- |
145 -- |
146 (:) :: forall a. a -> [a] -> [a]
146 (:) :: forall a. a -> [a] -> [a]