parsonsmatt/intero-neovim

The main module to load is ambiguous

Opened this issue · 3 comments

ahri commented

I'm trying to use intero-neovim on my project and I have two exes configured in my cabal file, so when I open a Haskell file and run :InteroInfo I get this:

Error detected while processing function intero#repl#info:                                                                     
line    2:                                                                                                                     
Intero is still starting up

I tried :InteroOpen and got this, more interesting message:

The main module to load is ambiguous. Candidates are:                                                                          
1. Package `mapdone' component exe:elmbridge with main-is file: /home/adam/repos/mapdone/server/elmbridge/Main.hs              
2. Package `mapdone' component exe:server with main-is file: /home/adam/repos/mapdone/server/server/Main.hs                    
You can specify which one to pick by:                                                                                          
 * Specifying targets to stack ghci e.g. stack ghci mapdone:exe:elmbridge                                                      
 * Specifying what the main is e.g. stack ghci --main-is mapdone:exe:elmbridge                                                 
 * Choosing from the candidate above [1..2]                                                                                    
* * * * * * * *                                                                                                                
                                                                                                                           
Specify main module to use (press enter to load none):

I can't actually answer the question as stdin doesn't appear to be connected.

I tried adding the following to my stack.yaml to clear up the confusion:

ghc-options:                                                                                                             
    main-is: mapdone:exe:server

But I still receive the same error about ambiguity.

I'm still fairly new to Haskell and the ecosystem so perhaps I've made a mistake somewhere. Is there something I can do to make this work? Commenting out the elmbridge exe "solves" the problem :)

You should be able to fix it by switching to the Intero buffer and selecting the module. It's not clear to me why stdin would be disconnected - did you forget to enter insert mode?

The other workaround is to use :InteroSetTargets to deselect one of the targets, but that's basically equivalent to removing it from the .cabal file from Intero's perspective.

Can you post the project? I don't have this behavior on my own multi-exe multi-package work project.

Similar problem, even setting g:intero_ghci_options to something like --main-is foo doesn't help