git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
fixed indentation and two examples
commita9c5bd9f5d57565b481e4c9ee283cb7348a5ad01 authorJP Smith <jp.smith@ilstu.edu> dateTue 24 Feb 2015, 14:39 (12 years ago) parent91f7221
2 files changed+28−28
prelude/README.md+14−14 prelude/prelude.purs+14−14
prelude/README.md+14−14
@@ -13,8 +13,8 @@ otherwise :: Boolean
1313An alias for `true`, which can be useful in guard clauses:
1414
1515```purescript
16− max x y | x >= y = x
17− | otherwise = y
16+max x y | x >= y = x
17+ | otherwise = y
1818```
1919
2020
@@ -27,7 +27,7 @@ flip :: forall a b c. (a -> b -> c) -> b -> a -> c
2727Flips the order of the arguments to a function of two arguments.
2828
2929```purescript
30− flip const 1 2 = const 2 1 = 2
30+flip const 1 2 = const 2 1 = 2
3131```
3232
3333
@@ -40,7 +40,7 @@ const :: forall a b. a -> b -> a
4040Returns its first argument and ignores its second.
4141
4242```purescript
43− const 1 "hello" = 1
43+const 1 "hello" = 1
4444```
4545
4646
@@ -54,7 +54,7 @@ This function returns its first argument, and can be used to assert type equalit
5454This can be useful when types are otherwise ambiguous.
5555
5656```purescript
57− main = print $ [] `asTypeOf` [0]
57+main = print $ [] `asTypeOf` [0]
5858```
5959
6060If instead, we had written `main = print []`, the type of the argument `[]` would have
@@ -125,12 +125,12 @@ instance categoryArr :: Category Prim.Function
125125Applies a function to its argument
126126
127127```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)))
129130```
130131
131−`($)` is different from [`(#)`](#-2) because it is right-infix instead of left. Right-infix
132−operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators parse like
133−`(((a # b) # c) # d ...)`.
132+`($)` is different from [`(#)`](#-2) because it is right-infix instead of left, so
133+`a $ b $ c $ d x` = `a (b (c (d x)))`
134134
135135
136136#### `(#)`
@@ -142,12 +142,12 @@ operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators pars
142142Applies a function to its argument
143143
144144```purescript
145− (((3 + 1) * 2) + 4) = 3 # ((+) 1) # ((*) 2) # ((+) 4)
145+products # groupby productcategory # filter isinstock # length =
146+length (groupby productcategory (filter isinstock (products)))
146147```
147148
148−`(#)` is different from [`($)`](#-1) because it is left-infix instead of right. Right-infix
149−operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators parse like
150−`(((a # b) # c) # d ...)`.
149+`(#)` is different from [`($)`](#-1) because it is left-infix instead of right, so
150+`x # a # b # c # d` = `(((x a) b) c) d`
151151
152152
153153#### `(:)`
@@ -159,7 +159,7 @@ operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators pars
159159Attaches an element to the front of a list.
160160
161161```purescript
162− 1 : [2, 3, 4] = [1, 2, 3, 4]
162+1 : [2, 3, 4] = [1, 2, 3, 4]
163163```
164164
165165
prelude/prelude.purs+14−14
@@ -32,8 +32,8 @@ module Prelude
3232 -- | An alias for `true`, which can be useful in guard clauses:
3333 -- |
3434 -- | ```purescript
35− -- | max x y | x >= y = x
36− -- | | otherwise = y
35+ -- | max x y | x >= y = x
36+ -- | | otherwise = y
3737 -- | ```
3838 -- |
3939 otherwise :: Boolean
@@ -42,7 +42,7 @@ module Prelude
4242 -- | Flips the order of the arguments to a function of two arguments.
4343 -- |
4444 -- | ```purescript
45− -- | flip const 1 2 = const 2 1 = 2
45+ -- | flip const 1 2 = const 2 1 = 2
4646 -- | ```
4747 -- |
4848 flip :: forall a b c. (a -> b -> c) -> b -> a -> c
@@ -51,7 +51,7 @@ module Prelude
5151 -- | Returns its first argument and ignores its second.
5252 -- |
5353 -- | ```purescript
54− -- | const 1 "hello" = 1
54+ -- | const 1 "hello" = 1
5555 -- | ```
5656 -- |
5757 const :: forall a b. a -> b -> a
@@ -61,7 +61,7 @@ module Prelude
6161 -- | This can be useful when types are otherwise ambiguous.
6262 -- |
6363 -- | ```purescript
64− -- | main = print $ [] `asTypeOf` [0]
64+ -- | main = print $ [] `asTypeOf` [0]
6565 -- | ```
6666 -- |
6767 -- | If instead, we had written `main = print []`, the type of the argument `[]` would have
@@ -112,12 +112,12 @@ module Prelude
112112 -- | Applies a function to its argument
113113 -- |
114114 -- | ```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)))
116117 -- | ```
117118 -- |
118− -- | `($)` is different from [`(#)`](#-2) because it is right-infix instead of left. Right-infix
119− -- | operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators parse like
120− -- | `(((a # b) # c) # d ...)`.
119+ -- | `($)` is different from [`(#)`](#-2) because it is right-infix instead of left, so
120+ -- | `a $ b $ c $ d x` = `a (b (c (d x)))`
121121 -- |
122122 ($) :: forall a b. (a -> b) -> a -> b
123123 ($) f x = f x
@@ -125,12 +125,12 @@ module Prelude
125125 -- | Applies a function to its argument
126126 -- |
127127 -- | ```purescript
128− -- | (((3 + 1) * 2) + 4) = 3 # ((+) 1) # ((*) 2) # ((+) 4)
128+ -- | products # groupby productcategory # filter isinstock # length =
129+ -- | length (groupby productcategory (filter isinstock (products)))
129130 -- | ```
130131 -- |
131− -- | `(#)` is different from [`($)`](#-1) because it is left-infix instead of right. Right-infix
132− -- | operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators parse like
133− -- | `(((a # b) # c) # d ...)`.
132+ -- | `(#)` is different from [`($)`](#-1) because it is left-infix instead of right, so
133+ -- | `x # a # b # c # d` = `(((x a) b) c) d`
134134 -- |
135135 (#) :: forall a b. a -> (a -> b) -> b
136136 (#) x f = f x
@@ -140,7 +140,7 @@ module Prelude
140140 -- | Attaches an element to the front of a list.
141141 -- |
142142 -- | ```purescript
143− -- | 1 : [2, 3, 4] = [1, 2, 3, 4]
143+ -- | 1 : [2, 3, 4] = [1, 2, 3, 4]
144144 -- | ```
145145 -- |
146146 (:) :: forall a. a -> [a] -> [a]