@@ -15,7 +15,6 @@ But this is not::
1515
1616 foo = bar(x) +
1717 baz(x)
18− data UnaryOperator
1918
2019Operators
2120---------
@@ -61,7 +60,7 @@ and the following binary operators (in precedence order):
6160Literal Values
6261--------------
6362
64−Numeric literals can be integers or floating point numbers. Numbers in hexadecimal notation should be preceded by the characters `0x`::
63+Numeric literals can be integers or floating point numbers. Numbers in hexadecimal notation should be preceded by the characters ``0x``::
6564
6665 16
6766 16.0
@@ -123,53 +122,14 @@ which would correspond to the following Javascript::
123122 }
124123 }
125124
126−Multiple argument functions can be introduced by wrapping the arguments in parentheses, and separating them with commas::
125+Function application is indicated by just the juxtaposition of a function with its arugments::
127126
128− example2 = \(a, b) -> a + b
127+ example1 10 20
129128
130−which generates::
129+Functions can also be defined at the top level by providing a list of patterns and an optional guard on the left hand side of the equals sign::
131130
132− function example2(a, b) {
133− return a + b;
134− }
135−
136−There is a special case for functions with no arguments, where the parentheses may be omitted, as follows::
137−
138− example3 = \ -> 100
139−
140−which would correspond to the Javascript::
141−
142− function example3() {
143− return 100;
144− }
145−
146−Multiple-argument and single-argument syntax can be mixed, as follows::
147−
148− example4 = \a (b, c) d -> a + b + c + d
149−
150−which generates::
151−
152− function example4(a) {
153− return function (b, c) {
154− return function (d) {
155− return a + b + c + d;
156− }
157− }
158− }
159−
160−Functions are applied by providing their arguments inside parentheses::
161−
162− test1(1, 2, 3)
163− test2()
164−
165−A special case is made in the case of functions with one argument. These functions can be applied without parentheses, and function application associates to the left::
166−
167− addThree :: Number -> Number -> Number -> Number
168− addThree a b c = a + b + c
169−
170− addThree 1 :: Number -> Number -> Number
171− addThree 1 2 :: Number -> Number
172− addThree 1 2 3 :: Number
131+ f [] [] = []
132+ f (x:xs) (y:ys) = x + y : f xs ys
173133
174134If-Then-Else Expressions
175135------------------------
@@ -204,23 +164,23 @@ Here is an example, using the maybe monad::
204164 isEven sum
205165 ret sum
206166
207−`isEven` adds two values of type `Maybe Number` and returns their sum, if the sum is even. If the sum is odd, `evenSum` returns `Nothing`.
167+``isEven`` adds two values of type ``Maybe Number`` and returns their sum, if the sum is even. If the sum is odd, ``evenSum`` returns ``Nothing``.
208168
209−When using `do` notation, the corresponding type constructor must be an instance of the `Prelude.Monad` type class, which defines the `ret` and `>>=` functions.
169+When using `do` notation, the corresponding type constructor must be an instance of the `Prelude.Monad` type class, which defines the ``ret`` and ``>>=`` functions.
210170
211171Statements can have the following form:
212172
213−- `a <- x` which desugars to `m.bind x (\a -> ...)`
214−- `let a = x` which desugars to `(\a -> ...)(x)`
215−- `x` which desugars to `m.bind x (\_ -> ...)` or just `x` if this is the last statement.
173+- ``a <- x`` which desugars to ``m.bind x (\a -> ...)` `
174+- ``let a = x`` which desugars to ``(\a -> ...)(x)``
175+- ``x`` which desugars to ``m.bind x (\_ -> ...)`` or just ``x`` if this is the last statement.
216176
217−Binders can be used on the left hand side of `<-` or `=`. For example::
177+Binders can be used on the left hand side of ``<-`` or ``=``. For example::
218178
219179 test arr = do
220180 (x:y:_) <- arr
221181 ret (x + y)
222182
223−A pattern match failure will generate a runtime exception, just as in the case of a regular `case` statement.
183+A pattern match failure will generate a runtime exception, just as in the case of a regular ``case`` statement.
224184
225185Operators
226186---------
@@ -251,11 +211,11 @@ Properties on records can be updated using the following syntax::
251211
252212 o { key = value, ..., key = value }
253213
254−For example, the following function increments the `foo` property on its argument::
214+For example, the following function increments the ``foo`` property on its argument::
255215
256− incr = \o -> o { foo = o.foo + 1 }
216+ incr o = o { foo = o.foo + 1 }
257217
258−The generated Javascript assumes the existence of a method called `Object.extend` such that `Object.extend(o, p)` takes an object `o` and generates a shallow copy of `o` including the properties of `p`. A simple JQuery implementation of this specification is::
218+The generated Javascript assumes the existence of a method called ``Object.extend`` such that ``Object.extend(o, p)`` takes an object ``o`` and generates a shallow copy of ``o`` including the properties of ``p``. A simple JQuery implementation of this specification is::
259219
260220 Object.prototype.extend = function(o, p) {
261221 return $.extend({}, o, p);