git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
made some corrections
commit91f72213c3af818859731c0138fd9619445b08be authorJP Smith <jp.smith@ilstu.edu> dateTue 24 Feb 2015, 10:40 (12 years ago) parent125b023
2 files changed+48−46
prelude/README.md+24−23 prelude/prelude.purs+24−23
prelude/README.md+24−23
@@ -12,10 +12,11 @@ otherwise :: Boolean
1212
1313An alias for `true`, which can be useful in guard clauses:
1414
15−E.g.
16−
15+```purescript
1716 max x y | x >= y = x
1817 | otherwise = y
18+```
19+
1920
2021#### `flip`
2122
@@ -25,9 +26,9 @@ flip :: forall a b c. (a -> b -> c) -> b -> a -> c
2526
2627Flips the order of the arguments to a function of two arguments.
2728
28−E.g.
29−
29+```purescript
3030 flip const 1 2 = const 2 1 = 2
31+```
3132
3233
3334#### `const`
@@ -38,9 +39,9 @@ const :: forall a b. a -> b -> a
3839
3940Returns its first argument and ignores its second.
4041
41−E.g.
42−
43− const 1 2 = 1
42+```purescript
43+ const 1 "hello" = 1
44+```
4445
4546
4647#### `asTypeOf`
@@ -52,9 +53,9 @@ asTypeOf :: forall a. a -> a -> a
5253This function returns its first argument, and can be used to assert type equalities.
5354This can be useful when types are otherwise ambiguous.
5455
55−E.g.
56−
56+```purescript
5757 main = print $ [] `asTypeOf` [0]
58+```
5859
5960If instead, we had written `main = print []`, the type of the argument `[]` would have
6061been ambiguous, resulting in a compile-time error.
@@ -123,13 +124,13 @@ instance categoryArr :: Category Prim.Function
123124
124125Applies a function to its argument
125126
126−E.g.
127−
128− const $ 1 2 = const 1 2 = 1
127+```purescript
128+ (+) 1 ((*) 2 (const 1 2)) = (+) 1 $ (*) 2 $ const 1 2
129+```
129130
130−`($)` is different from [`(#)`](#-2) because it is right-infix instance instead of left.
131−Right-infix operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators parse
132−like (((a # b) # c) # d ...).
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 ...)`.
133134
134135
135136#### `(#)`
@@ -140,13 +141,13 @@ like (((a # b) # c) # d ...).
140141
141142Applies a function to its argument
142143
143−E.g.
144−
145− 3 # ((+) 1) = 3 + 1 = 4
144+```purescript
145+ (((3 + 1) * 2) + 4) = 3 # ((+) 1) # ((*) 2) # ((+) 4)
146+```
146147
147−`(#)` is different from [`($)`](#-1) because it is left-infix instance instead of right.
148−Right-infix operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators parse
149−like (((a # b) # c) # d ...).
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 ...)`.
150151
151152
152153#### `(:)`
@@ -157,9 +158,9 @@ like (((a # b) # c) # d ...).
157158
158159Attaches an element to the front of a list.
159160
160−E.g.
161−
161+```purescript
162162 1 : [2, 3, 4] = [1, 2, 3, 4]
163+```
163164
164165
165166#### `cons`
prelude/prelude.purs+24−23
@@ -31,27 +31,28 @@ module Prelude
3131
3232 -- | An alias for `true`, which can be useful in guard clauses:
3333 -- |
34− -- | E.g.
35− -- |
34+ -- | ```purescript
3635 -- | max x y | x >= y = x
3736 -- | | otherwise = y
37+ -- | ```
38+ -- |
3839 otherwise :: Boolean
3940 otherwise = true
4041
4142 -- | Flips the order of the arguments to a function of two arguments.
4243 -- |
43− -- | E.g.
44− -- |
44+ -- | ```purescript
4545 -- | flip const 1 2 = const 2 1 = 2
46+ -- | ```
4647 -- |
4748 flip :: forall a b c. (a -> b -> c) -> b -> a -> c
4849 flip f b a = f a b
4950
5051 -- | Returns its first argument and ignores its second.
5152 -- |
52− -- | E.g.
53− -- |
54− -- | const 1 2 = 1
53+ -- | ```purescript
54+ -- | const 1 "hello" = 1
55+ -- | ```
5556 -- |
5657 const :: forall a b. a -> b -> a
5758 const a _ = a
@@ -59,9 +60,9 @@ module Prelude
5960 -- | This function returns its first argument, and can be used to assert type equalities.
6061 -- | This can be useful when types are otherwise ambiguous.
6162 -- |
62− -- | E.g.
63− -- |
63+ -- | ```purescript
6464 -- | main = print $ [] `asTypeOf` [0]
65+ -- | ```
6566 -- |
6667 -- | If instead, we had written `main = print []`, the type of the argument `[]` would have
6768 -- | been ambiguous, resulting in a compile-time error.
@@ -110,26 +111,26 @@ module Prelude
110111
111112 -- | Applies a function to its argument
112113 -- |
113− -- | E.g.
114− -- |
115− -- | const $ 1 2 = const 1 2 = 1
114+ -- | ```purescript
115+ -- | (+) 1 ((*) 2 (const 1 2)) = (+) 1 $ (*) 2 $ const 1 2
116+ -- | ```
116117 -- |
117− -- | `($)` is different from [`(#)`](#-2) because it is right-infix instance instead of left.
118− -- | Right-infix operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators parse
119− -- | like (((a # b) # c) # d ...).
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 ...)`.
120121 -- |
121122 ($) :: forall a b. (a -> b) -> a -> b
122123 ($) f x = f x
123124
124125 -- | Applies a function to its argument
125126 -- |
126− -- | E.g.
127+ -- | ```purescript
128+ -- | (((3 + 1) * 2) + 4) = 3 # ((+) 1) # ((*) 2) # ((+) 4)
129+ -- | ```
127130 -- |
128− -- | 3 # ((+) 1) = 3 + 1 = 4
129− -- |
130− -- | `(#)` is different from [`($)`](#-1) because it is left-infix instance instead of right.
131− -- | Right-infix operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators parse
132− -- | like (((a # b) # c) # d ...).
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 ...)`.
133134 -- |
134135 (#) :: forall a b. a -> (a -> b) -> b
135136 (#) x f = f x
@@ -138,9 +139,9 @@ module Prelude
138139
139140 -- | Attaches an element to the front of a list.
140141 -- |
141− -- | E.g.
142− -- |
142+ -- | ```purescript
143143 -- | 1 : [2, 3, 4] = [1, 2, 3, 4]
144+ -- | ```
144145 -- |
145146 (:) :: forall a. a -> [a] -> [a]
146147 (:) = cons