summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-07-19 20:38:05 +0100
committerIan Lynagh <igloo@earth.li>2012-07-19 20:38:05 +0100
commit322044b2670fe9dca22122dbf4cc79fa29b4442c (patch)
treee3226359676fab1cc0560f6ed827d598fb2ddfc5 /docs
parentfb0769b62e3ea4392ad970f8913a76187fead79f (diff)
parent0f693381e356ec90ee72ab40b21b74cbf4e20eb3 (diff)
downloadhaskell-322044b2670fe9dca22122dbf4cc79fa29b4442c.tar.gz
Merge branch 'master' of darcs.haskell.org:/srv/darcs//ghc
Diffstat (limited to 'docs')
-rw-r--r--docs/users_guide/flags.xml12
-rw-r--r--docs/users_guide/glasgow_exts.xml42
2 files changed, 54 insertions, 0 deletions
diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml
index bb7ae45ba8..7cbeeab551 100644
--- a/docs/users_guide/flags.xml
+++ b/docs/users_guide/flags.xml
@@ -1122,6 +1122,18 @@
<entry><option>-XNoPackageImports</option></entry>
</row>
<row>
+ <entry><option>-XLambdaCase</option></entry>
+ <entry>Enable <link linkend="lambda-case">lambda-case expressions</link>.</entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoLambdaCase</option></entry>
+ </row>
+ <row>
+ <entry><option>-XMultiWayIf</option></entry>
+ <entry>Enable <link linkend="multi-way-if">multi-way if-expressions</link>.</entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoMultiWayIf</option></entry>
+ </row>
+ <row>
<entry><option>-XSafe</option></entry>
<entry>Enable the <link linkend="safe-haskell">Safe Haskell</link> Safe mode.</entry>
<entry>dynamic</entry>
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml
index df1ff2c181..dde235eda4 100644
--- a/docs/users_guide/glasgow_exts.xml
+++ b/docs/users_guide/glasgow_exts.xml
@@ -1669,6 +1669,48 @@ continues to stand for the unboxed singleton tuple data constructor.
</sect2>
+<sect2 id="lambda-case">
+<title>Lambda-case</title>
+<para>
+The <option>-XLambdaCase</option> flag enables expressions of the form
+<programlisting>
+ \case { p1 -> e1; ...; pN -> eN }
+</programlisting>
+which is equivalent to
+<programlisting>
+ \freshName -> case freshName of { p1 -> e1; ...; pN -> eN }
+</programlisting>
+Note that <literal>\case</literal> starts a layout, so you can write
+<programlisting>
+ \case
+ p1 -> e1
+ ...
+ pN -> eN
+</programlisting>
+</para>
+</sect2>
+
+<sect2 id="multi-way-if">
+<title>Multi-way if-expressions</title>
+<para>
+With <option>-XMultiWayIf</option> flag GHC accepts conditional expressions
+with multiple branches:
+<programlisting>
+ if | guard1 -> expr1
+ | ...
+ | guardN -> exprN
+</programlisting>
+which is roughly equivalent to
+<programlisting>
+ case () of
+ _ | guard1 -> expr1
+ ...
+ _ | guardN -> exprN
+</programlisting>
+except that multi-way if-expressions do not alter the layout.
+</para>
+</sect2>
+
<sect2 id="disambiguate-fields">
<title>Record field disambiguation</title>
<para>