@@ -1079,7 +1079,7 @@ provided compared to Emacs' basic Compilation mode are:
1079
1079
@itemize
1080
1080
@item
1081
1081
DWIM-style auto-detection of compile command (including support for
1082
- CABAL projects)
1082
+ stack and cabal projects)
1083
1083
@item
1084
1084
Support for GHC's compile messages and recognizing error, warning and
1085
1085
info source locations (including @option {-ferror-spans } syntax)
@@ -1106,40 +1106,56 @@ initialization to bind @code{haskell-compile} to @kbd{C-c C-c}.
1106
1106
The following description assumes that @code {haskell-compile } has been
1107
1107
bound to @kbd {C-c C-c }.
1108
1108
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 }.
1112
1111
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
1121
1113
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 }.
1125
1128
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 }.)
1132
1143
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 }.
1136
1145
1137
1146
You can also inspect and modify the compile command to be invoked
1138
1147
temporarily by invoking @code {haskell-compile } with a prefix argument
1139
1148
(e.g. @kbd {C-u C-c C-c }). If later-on you want to recompile using the
1140
1149
same customized compile command, invoke @code {recompile } (bound to
1141
1150
@kbd {g }) inside the @samp {*haskell-compilation* } buffer.
1142
1151
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
+
1143
1159
@section Keybindings
1144
1160
1145
1161
@multitable 0.3 0.7
@@ -1275,24 +1291,27 @@ for the current GHCi session.
1275
1291
1276
1292
@cindex customizing
1277
1293
What 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:
1285
1306
1286
1307
@itemize
1287
1308
@item
1288
1309
If it's @code {ghci }, @code {haskell-process-path-ghci } and
1289
1310
@code {haskell-process-args-ghci } will be used.
1290
1311
@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.
1296
1315
@item
1297
1316
If it's @code {stack-ghci }, @code {haskell-process-path-stack } and
1298
1317
@code {haskell-process-args-stack-ghci } will be used.
@@ -1310,7 +1329,6 @@ strings specifying (further) command-line arguments.
1310
1329
@vindex haskell-process-path-stack
1311
1330
@vindex haskell-process-args-ghci
1312
1331
@vindex haskell-process-args-cabal-repl
1313
- @vindex haskell-process-args-cabal-new-repl
1314
1332
@vindex haskell-process-args-stack-ghci
1315
1333
1316
1334
@section Haskell Interactive Mode Setup
@@ -1398,8 +1416,6 @@ Here is a list of available process types:
1398
1416
@item ghci
1399
1417
@item cabal-repl
1400
1418
@item cabal-new-repl
1401
- @item cabal-dev
1402
- @item cabal-ghci
1403
1419
@item stack-ghci
1404
1420
@end itemize
1405
1421
@@ -2774,14 +2790,14 @@ if the @code{haskell-process-type} is @code{'auto}, the directories are searched
2774
2790
@code {cabal.sandbox.config } or @code {stack.yaml } or @code {*.cabal } file.
2775
2791
If the file is present, then appropriate process is started.
2776
2792
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 }.
2778
2795
Similarly, when @code {stack.yaml } is found @code {haskell-process-type } is @code {'stack-ghci }.
2779
2796
Similarly, when @code {xyz.cabal } is found @code {haskell-process-type } is @code {'cabal-repl }.
2780
2797
When nothing is found @code {haskell-process-type } is @code {'ghci }. When more than one
2781
2798
file 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 }
2785
2801
2786
2802
@node Collapsing Haskell code
2787
2803
@chapter Collapsing Haskell code
0 commit comments