@@ -19,15 +19,15 @@ have already seen this function in Section :ref:`sect-lazy`):
20.. code-block:: idris
20.. code-block:: idris
22− boolCase : (x:Bool) -> Lazy a -> Lazy a -> a;
22+ ifThenElse : (x:Bool) -> Lazy a -> Lazy a -> a;
23− boolCase True t e = t;
23+ ifThenElse True t e = t;
24− boolCase False t e = e;
24+ ifThenElse False t e = e;
26and then extend the core syntax with a ``syntax`` declaration:
26and then extend the core syntax with a ``syntax`` declaration:
28.. code-block:: idris
28.. code-block:: idris
30− syntax "if" [test] "then" [t] "else" [e] = boolCase test t e;
30+ syntax if [test] then [t] else [e] = ifThenElse test t e;
32The left hand side of a ``syntax`` declaration describes the syntax
32The left hand side of a ``syntax`` declaration describes the syntax
33rule, and the right hand side describes its expansion. The syntax rule
33rule, and the right hand side describes its expansion. The syntax rule
@@ -58,10 +58,10 @@ recursive. The following syntax extensions would therefore be valid:
59.. code-block:: idris
59.. code-block:: idris
61− syntax [var] ":=" [val] = Assign var val;
61+ syntax [var] ":=" [val] = Assign var val;
62− syntax [test] "?" [t] ":" [e] = if test then t else e;
62+ syntax [test] "?" [t] ":" [e] = if test then t else e;
63− syntax "select" [x] "from" [t] "where" [w] = SelectWhere x t w;
63+ syntax select [x] from [t] "where" [w] = SelectWhere x t w;
64− syntax "select" [x] "from" [t] = Select x t;
64+ syntax select [x] from [t] = Select x t;
66Syntax macros can be further restricted to apply only in patterns (i.e.,
66Syntax macros can be further restricted to apply only in patterns (i.e.,
67only on the left hand side of a pattern match clause) or only in terms
67only on the left hand side of a pattern match clause) or only in terms
@@ -92,7 +92,7 @@ forms. For example, a ``for`` loop binds a variable on each iteration:
93.. code-block:: idris
93.. code-block:: idris
95− syntax "for" {x} "in" [xs] ":" [body] = forLoop xs (\x => body)
95+ syntax for {x} in [xs] ":" [body] = forLoop xs (\x => body)
97 main : IO ()
97 main : IO ()
98 main = do for x in [1..10]:
98 main = do for x in [1..10]: