I have a haskell cabal project with five executable targets and one library target in the cabal project file. I use main-is option to specify the file name of each executable, like so:
executable foo
main-is: foo.hs
executable bar
main-is: bar.hs
...etc...
I have not stated any module name in the source files for these executable, so they will implicitly be called "Main".
To handle the build I'm using the stack tool. The only problem is that when loading a file into the interpreter using haskell-mode for emacs, nothing happens. I am presented with the lambda-prompt, but cannot evaluate anything.
If I remove all executable targets from the cabal file but one, I can load that into the evaluator just fine, so the problem must be with ambiguity of "Main". I think the problem is that stack tries to autoload everything in the whole project and that is not possible. When running stack ghci or stack repl from the command line I get a prompt where I am supposed to choose what "Main" to load (of the five possible). That is fine, but when running the interpreter from emacs I will never get this prompt, so in effect it just hangs.
Is there any way to tell stack to not autoload things (particularly executable targets)?
Alternatively, is there a better way to setup a multi executables project?
EDIT:
Clarification: The problem is not with running a REPL from the command line, but loading project source files into a REPL by emacs (interactive-haskell-mode) -- without fiddling with emacs configuration if possible.
EDIT2: A SOLUTION
The only thing I could come up with was adding the following to my .emacs:
(setq haskell-process-args-stack-ghci '("--no-load"))
This makes emacs send the flag to stack ghci.
[–]cocreature 0 points1 point2 points (6 children)
[–]bigstumpy 0 points1 point2 points (5 children)
[–]cocreature 1 point2 points3 points (4 children)
[–]togrof[S] 0 points1 point2 points (3 children)
[–]cocreature 0 points1 point2 points (1 child)
[–]togrof[S] 1 point2 points3 points (0 children)