Dante-mode and haskell-mode in non-Stack-friendly projects
I started reading Parallel and Concurrent Programming in Haskell by Simon Marlow, which has example code in parconc-examples. At the moment, it will only build with ghc 8.2.2, but it was easy enough to point stack at an older LTS version that used 8.2.2.
parconc-examples is not set up like a Stack project, because individual source code files each have their own main function. This causes stack ghci to complain about the ambiguity:
The main module to load is ambiguous. Candidates are: 1. Package `parconc-examples' component parconc-examples:exe:GenSamples with main-is file: /Users/shaun/workspace/parconc-examples-0.4.7/kmeans/GenSamples.hs .. [~ 80 more examples here]
However, stack exec ghci works just fine.
Now the problem is getting dante-mode and haskell-mode to use stack exec ghci instead of the default stack ghci.
A .dir-local file at the root of the parconc-examples directory seemed like the right thing to do to keep the setup from messing with other parts of the setup. This looks like:
((haskell-mode . ((haskell-process-path-stack . ("stack" "exec")) (haskell-process-args-stack-ghci . ("--" "-ferror-spans")) (dante-repl-command-line . ("stack" "exec" "ghci")))))
The documentation says that this is a list mapping major modes to variables. dante is a minor mode, so the dante-repl-command-line variable goes under the list of haskell-mode variables.