summaryrefslogtreecommitdiff
path: root/docs/users_guide
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2015-06-24 12:52:16 +0200
committerThomas Miedema <thomasmiedema@gmail.com>2015-06-26 13:22:27 +0200
commit7c8ffd3d8c328d5ca145fe15638ec5c952782132 (patch)
tree0e47d3e53f16c8781f330305c314ec2708a7496e /docs/users_guide
parent111ba4beda4ffc48381723da12e5b237d7f9ac59 (diff)
downloadhaskell-7c8ffd3d8c328d5ca145fe15638ec5c952782132.tar.gz
GHCi docs: layout rule is respected inside :{ :}
Summary: I don't know if or when this changed, but the documentation on :{ :} (multiline input) seems out of date. Layout rule works fine. I added a regression test. Reviewers: austin Subscribers: thomie, bgamari Differential Revision: https://phabricator.haskell.org/D1013
Diffstat (limited to 'docs/users_guide')
-rw-r--r--docs/users_guide/ghci.xml20
1 files changed, 8 insertions, 12 deletions
diff --git a/docs/users_guide/ghci.xml b/docs/users_guide/ghci.xml
index d3b65ef807..a1271e1ac1 100644
--- a/docs/users_guide/ghci.xml
+++ b/docs/users_guide/ghci.xml
@@ -437,10 +437,10 @@ Prelude>
<listitem>
<para>The variable's type is not polymorphic, is not
<literal>()</literal>, and is an instance of
- <literal>Show</literal></para>
+ <literal>Show</literal>.</para>
</listitem>
</itemizedlist>
- <indexterm><primary><option>-fprint-bind-result</option></primary></indexterm><indexterm><primary><option>-fno-print-bind-result</option></primary></indexterm>.
+ <indexterm><primary><option>-fprint-bind-result</option></primary></indexterm><indexterm><primary><option>-fno-print-bind-result</option></primary></indexterm>
</para>
<para>Of course, you can also bind normal non-IO expressions
@@ -477,9 +477,9 @@ Prelude>
<para>However, this quickly gets tedious when defining functions
with multiple clauses, or groups of mutually recursive functions,
because the complete definition has to be given on a single line,
- using explicit braces and semicolons instead of layout:</para>
+ using explicit semicolons instead of layout:</para>
<screen>
-Prelude> let { f op n [] = n ; f op n (h:t) = h `op` f op n t }
+Prelude> let f op n [] = n ; f op n (h:t) = h `op` f op n t
Prelude> f (+) 0 [1..3]
6
Prelude>
@@ -489,18 +489,14 @@ Prelude>
<literal>:}</literal> (each on a single line of its own):</para>
<screen>
Prelude> :{
-Prelude| let { g op n [] = n
-Prelude| ; g op n (h:t) = h `op` g op n t
-Prelude| }
+Prelude| let g op n [] = n
+Prelude| g op n (h:t) = h `op` g op n t
Prelude| :}
Prelude> g (*) 1 [1..3]
6
</screen>
<para>Such multiline commands can be used with any GHCi command,
- and the lines between <literal>:{</literal> and
- <literal>:}</literal> are simply merged into a single line for
- interpretation. That implies that each such group must form a single
- valid command when merged, and that no layout rule is used.
+ and note that the layout rule is in effect.
The main purpose of multiline commands is not to replace module
loading but to make definitions in .ghci-files (see <xref
linkend="ghci-dot-files"/>) more readable and maintainable.</para>
@@ -575,7 +571,7 @@ Prelude>
</screen>
<para>Explicit braces and semicolons can be used instead of
- layout, as usual:</para>
+ layout:</para>
<screen>
Prelude> do {