git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Update syntax.rst
cfca067Phil Freeman
docs/source/syntax.rst+10−6
@@ -195,22 +195,26 @@ Operators
195
195
196User-defined infix operators can be created by enclosing names in parentheses.
196User-defined infix operators can be created by enclosing names in parentheses.
197
197
198−E.g. to create a synonym for string concatenation::
198+E.g. to create an infix synonym for the ``Data.Array.range`` function::
199
199
200− (<>) = \s1 s2 -> s1 ++ s2
200+ (..) :: Number -> Number -> [Number]
201+ (..) = Data.Array.range
201
202
202− greeting = "Hello" <> "World!"
203+This function can be used as follows::
204+
205+ oneToTen = 1 .. 10
203
206
204Regular functions can be used as operators by enclosing their names in backticks::
207Regular functions can be used as operators by enclosing their names in backticks::
205
208
206− foo = \x y -> x * y + y
209+ foo x y = x * y + y
207
210
208 test = 10 `foo` 20
211 test = 10 `foo` 20
209
212
210Fixity declarations can associate a precedence level, which is a natural number, to a user-defined operator, and specify which way it associates::
213Fixity declarations can associate a precedence level, which is a natural number, to a user-defined operator, and specify which way it associates::
211
214
212− infixl 5 <>
215+ infix 5 ..
213− infixr 7 %%
216+ infixl 7 %%
217+ infixr 9 ^^
214
218
215Record Updates
219Record Updates
216--------------
220--------------