Skip to content

Commit 74fa98b

Browse files
committed
Document multiline input
1 parent b4fe973 commit 74fa98b

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

doc/haskell-mode.texi

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,6 +1754,42 @@ To evaluate expressions, simply type one out and hit `RET`.
17541754
123
17551755
@end example
17561756

1757+
@subsection Evaluating multiline expressions
1758+
1759+
GHCi features two ways to evaluate multiline expressions. You can use
1760+
@code{:set +m} to
1761+
enable @uref{https://www.haskell.org/ghc/docs/latest/html/users_guide/ghci.html#multiline-input,
1762+
multiline input} for all expressions, or you can wrap your expression in
1763+
@code{:@{} and @code{:@}} (they have to be on their own lines).
1764+
1765+
The prompt will change to indicate that you're inputting a multiline
1766+
expression:
1767+
1768+
@example
1769+
λ> :@{
1770+
λ| let a = 10
1771+
λ| b = 20
1772+
λ| c = 30
1773+
λ| :@}
1774+
@end example
1775+
1776+
You can also simulate multiline mode by having your input contain
1777+
newline characters. You can input a literal newline character with
1778+
@kbd{C-q C-j}, or you can use:
1779+
1780+
@example
1781+
M-x haskell-interactive-mode-newline-indent
1782+
@end example
1783+
1784+
which is bound to @kbd{C-j}. This command indents after the newline. You
1785+
can simulate the above example like so:
1786+
1787+
@example
1788+
λ> let a = 10
1789+
b = 20
1790+
c = 30
1791+
@end example
1792+
17571793
@subsection Type of expressions
17581794

17591795
You can use normal @code{:type} which is part of GHCi to get the type of

0 commit comments

Comments
 (0)