@@ -1079,7 +1079,7 @@ provided compared to Emacs' basic Compilation mode are:
10791079@itemize
10801080@item
10811081DWIM-style auto-detection of compile command (including support for
1082- CABAL projects)
1082+ stack and cabal projects)
10831083@item
10841084Support for GHC's compile messages and recognizing error, warning and
10851085info source locations (including @option {-ferror-spans } syntax)
@@ -1106,40 +1106,56 @@ initialization to bind @code{haskell-compile} to @kbd{C-c C-c}.
11061106The following description assumes that @code {haskell-compile } has been
11071107bound to @kbd {C-c C-c }.
11081108
1109- @vindex haskell-compile-cabal-build-command
1110- @vindex haskell-compile-cabal-build-command-alt
1111- @vindex haskell-compile-command
1109+ When invoked, @code {haskell-compile } decides what build tool to run by
1110+ consulting the value of @code {haskell-compiler-type }.
11121111
1113- When invoked, @code {haskell-compile } tries to guess how to compile the
1114- Haskell program your currently visited buffer belongs to, by searching
1115- for a @file {.cabal } file in the current of enclosing parent folders. If
1116- a @file {.cabal } file was found, the command defined in the
1117- @code {haskell-compile-cabal-build-command } option is used. Note that to
1118- compile a @code {stack } based project you will need to set this variable to
1119- @code {stack build }. As usual you can do it using @code {M-x customize-variable }
1120- or with:
1112+ @itemize
11211113
1122- @lisp
1123- (setq haskell-compile-cabal-build-command " stack build" )
1124- @end lisp
1114+ @item
1115+ If this is the symbol @code {cabal }, then @code {cabal } is run, using the
1116+ command defined by @code {haskell-compile-cabal-build-command }.
1117+ @code {haskell-compile } looks for a @file {.cabal } file in the current directory
1118+ or its closet ancestor.
1119+
1120+ @item
1121+ If @code {haskell-compiler-type } is the symbol @code {stack }, then @code {stack }
1122+ is run, using the command @code {haskell-compile-stack-build-command }, and
1123+ looking for the closest @file {stack.yaml } file.
1124+
1125+ @item
1126+ If @code {haskell-compiler-type } is the symbol @code {ghc }, then @code {ghc } is
1127+ run, using the command @code {haskell-compile-command }.
11251128
1126- Moreover, when requesting to compile a @file {.cabal }-file is detected and
1127- a negative prefix argument (e.g. @kbd {C-- C-c C-c }) was given, the
1128- alternative @code {haskell-compile-cabal-build-command-alt } is
1129- invoked. By default, @code {haskell-compile-cabal-build-command-alt }
1130- contains a @samp {cabal clean -s } command in order to force a full
1131- rebuild.
1129+ @item
1130+ But if @code {haskell-compiler-type } is the symbol @code {auto } (the default),
1131+ then emacs tries to choose which build tool to use by looking for the closest
1132+ @file {stack.yaml } or @file {.cabal } file. (This is similar to the way
1133+ @code {haskell-interactive-mode } uses the variable
1134+ @code {haskell-process-type }.)
1135+ @end itemize
1136+
1137+ Moreover, when a negative prefix argument is supplied (e.g. @kbd {C-- C-c C-c }),
1138+ the alternative build command is used, that is,
1139+ @code {haskell-compile-cabal-build-command-alt } or
1140+ @code {haskell-compile-stack-build-command-alt }.
1141+ By default, the alternative build commands force a full rebuild.
1142+ (Note this does not affect @code {haskell-compile-command }.)
11321143
1133- Otherwise if no @file {.cabal } could be found, a single-module
1134- compilation is assumed and @code {haskell-compile-command } is used
1135- (@emph {if } the currently visited buffer contains Haskell source code).
1144+ As usual you can change any of these variables using @code {M-x customize-variable }.
11361145
11371146You can also inspect and modify the compile command to be invoked
11381147temporarily by invoking @code {haskell-compile } with a prefix argument
11391148(e.g. @kbd {C-u C-c C-c }). If later-on you want to recompile using the
11401149same customized compile command, invoke @code {recompile } (bound to
11411150@kbd {g }) inside the @samp {*haskell-compilation* } buffer.
11421151
1152+ @vindex haskell-compiler-type
1153+ @vindex haskell-compile-command
1154+ @vindex haskell-compile-stack-build-command
1155+ @vindex haskell-compile-cabal-build-command
1156+ @vindex haskell-compile-stack-build-alt-command
1157+ @vindex haskell-compile-cabal-build-alt-command
1158+
11431159@section Keybindings
11441160
11451161@multitable 0.3 0.7
@@ -1275,24 +1291,27 @@ for the current GHCi session.
12751291
12761292@cindex customizing
12771293What kind of Haskell REPL @code {haskell-interactive-mode } will start up
1278- depends on the value of @code {haskell-process-type }. This can be one of the
1279- symbols @code {auto }, @code {ghci }, @code {cabal-repl }, @code {cabal-new-repl }, or
1280- @code {stack-ghci }. If it's @code {auto }, the directory contents and available
1281- programs will be used to make a best guess at the process type. The actual
1282- process type will then determine which variables
1283- @code {haskell-interactive-mode } will access to determine the program to start
1284- and its arguments:
1294+ depends on the value of @code {haskell-process-type }. This can be one of
1295+ the symbols @code {auto }, @code {ghci }, @code {stack-ghci },
1296+ @code {cabal-repl }, or @code {cabal-new-repl }.
1297+
1298+ (@code {cabal-new-repl } is allowed but obsolete, like the cabal command
1299+ @code {new-build } that it selected. Emacs actually runs the equivalent
1300+ cabal command @code {build }.)
1301+
1302+ If it's @code {auto }, the directory contents and available programs will
1303+ be used to make a best guess at the process type. The actual process
1304+ type will then determine which variables @code {haskell-interactive-mode }
1305+ will access to determine the program to start and its arguments:
12851306
12861307@itemize
12871308@item
12881309If it's @code {ghci }, @code {haskell-process-path-ghci } and
12891310@code {haskell-process-args-ghci } will be used.
12901311@item
1291- If it's @code {cabal-repl }, @code {haskell-process-path-cabal } and
1292- @code {haskell-process-args-cabal-repl }.
1293- @item
1294- If it's @code {cabal-new-repl }, @code {haskell-process-path-cabal } and
1295- @code {haskell-process-args-cabal-new-repl }.
1312+ If it's @code {cabal-repl } or @code {cabal-new-repl },
1313+ @code {haskell-process-path-cabal } and
1314+ @code {haskell-process-args-cabal-repl } are used.
12961315@item
12971316If it's @code {stack-ghci }, @code {haskell-process-path-stack } and
12981317@code {haskell-process-args-stack-ghci } will be used.
@@ -1310,7 +1329,6 @@ strings specifying (further) command-line arguments.
13101329@vindex haskell-process-path-stack
13111330@vindex haskell-process-args-ghci
13121331@vindex haskell-process-args-cabal-repl
1313- @vindex haskell-process-args-cabal-new-repl
13141332@vindex haskell-process-args-stack-ghci
13151333
13161334@section Haskell Interactive Mode Setup
@@ -1398,8 +1416,6 @@ Here is a list of available process types:
13981416@item ghci
13991417@item cabal-repl
14001418@item cabal-new-repl
1401- @item cabal-dev
1402- @item cabal-ghci
14031419@item stack-ghci
14041420@end itemize
14051421
@@ -2774,14 +2790,14 @@ if the @code{haskell-process-type} is @code{'auto}, the directories are searched
27742790@code {cabal.sandbox.config } or @code {stack.yaml } or @code {*.cabal } file.
27752791If the file is present, then appropriate process is started.
27762792
2777- When @code {cabal.sandbox.config } is found @code {haskell-process-type } is @code {'cabal-repl }.
2793+ When @code {cabal.project } or @code {cabal.sandbox.config } is found,
2794+ @code {haskell-process-type } is @code {'cabal-repl }.
27782795Similarly, when @code {stack.yaml } is found @code {haskell-process-type } is @code {'stack-ghci }.
27792796Similarly, when @code {xyz.cabal } is found @code {haskell-process-type } is @code {'cabal-repl }.
27802797When nothing is found @code {haskell-process-type } is @code {'ghci }. When more than one
27812798file such as @code {cabal.sandbox.config } and @code {stack.yaml } are found the following
2782- preference is followed.
2783-
2784- @code {cabal.sandbox.config } > @code {stack.yaml } > @code {*.cabal }
2799+ preference is followed:
2800+ @code {cabal.project } > @code {stack.yaml } > @code {*.cabal }
27852801
27862802@node Collapsing Haskell code
27872803@chapter Collapsing Haskell code
0 commit comments