Skip to content

Commit beb2324

Browse files
Add some troubleshooting notes. (#418)
1 parent 4aaba4d commit beb2324

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

docs/Setup.md

+28-1
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,21 @@ with the following content:
5454
cradle: {cabal: {component: "mylibrary"}}
5555
```
5656

57+
If you are using stack, find the list of names you can use:
58+
59+
$ stack ide targets
60+
mypackage:lib
61+
mypackage:exe:mypackage-exe
62+
mypackage:test:mypackage-test
63+
64+
and create a `hie.yaml` file as follows:
65+
66+
{stack: {component: "mypackage:lib"}}
67+
5768
## ghc: readCreateProcess: does not exist
5869

70+
On Linux: try `stack exec ghcide`` instead of `ghcide` directly.
71+
5972
I was getting this in Windows: `ghcide.exe: ghc: readCreateProcess: does not exist (No such file or directory)`
6073

6174
And we figured a hack around for this:
@@ -69,7 +82,21 @@ Since I use stack. Required if you don't have a `ghc` on your path.
6982

7083
## Could not find module ...
7184

72-
Try adding an explicit hie.yaml file and see if that helps.
85+
Try adding an explicit `hie.yaml` file and see if that helps.
86+
87+
## Ambiguous main module
88+
89+
```console
90+
$ stack exec ghcide
91+
92+
...
93+
94+
ghcide: CradleError (ExitFailure 1) ["Failed to parse result of calling stack","","* * * * * * * *","The main module to load is ambiguous. Candidates are: ","1. Package `mypackage' component mypackage:exe:mypackage-exe with main-is file: /home/user/mypackage/app/Main.hs","2. Package `mypackage' component mypackage:exe:otherbin-exe with main-is file: /home/user/mypackage/app/otherbin.hs","You can specify which one to pick by: "," * Specifying targets to stack ghci e.g. stack ghci mypackage:exe:mypackage-exe"," * Specifying what the main is e.g. stack ghci --main-is mypackage:exe:mypackage-exe"," * Choosing from the candidate above [1..2]","* * * * * * * *","","<stdin>: hGetLine: end of file"]
95+
```
96+
97+
Add a `hie.yaml` file to specify the module, e.g.
98+
99+
cradle: {stack: {component: "mypackage:exe:mypackage-exe"}}
73100

74101
## Works in `ghcide` but not my editor
75102

0 commit comments

Comments
 (0)