`cabal exec ghc --` vs. `cabal exec -- ghc` vs. `cabal --ghc`
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
This is probably just a documentation issue, but I am struggling to understand what the difference is between these (particularly the first two) cases.
```
cabal exec ghc --
cabal exec -- ghc
cabal --ghc exec ...
```
I have a couple of cases, with which I am wrestling. The following is aa fragment from a test harness that runs a ghc plugin over some test cases by compiling them:
```haskell
62 -- | Use `cabal exec` to run the compilation, so that the smuggler plugin is
63 -- picked up from the local database. GHC alone would use the global one.
64 compile :: FilePath -> Options -> IO ()
65 compile testcase opts = runProcess_ cabalConfig
66 where
67 cabalConfig :: ProcessConfig () () ()
68 cabalConfig = proc cabalCmd cabalArgs
69
70 cabalCmd :: FilePath
71 cabalCmd = "cabal"
72
73 cabalArgs :: [String]
74 cabalArgs =
75 -- * no sure why it is necessary to mention the smuggler package explicitly,
76 -- but it appears to be hidden otherwise.
77 -- * This puts the .imports files that smuggler generates somewhere they
78 -- can easily be found
79 ["exec", "ghc", "--", "-package smuggler", "-v0", "-dumpdir=" ++ testDir, "-fno-code", "-fplugin=Smuggler.Plugin"]
80 ++ map
81 ("-fplugin-opt=Smuggler.Plugin:" ++)
82 ( let ia = importAction opts
83 ea = exportAction opts
84 p = [show ia, show ea]
85 in case newExtension opts of
86 Nothing -> mkExt ia ea : p -- provide a default extension
87 Just e -> e : p
88 )
89 ++ [testcase]
```
- Is line 79 the correct way to call ghc? (`--` order, `-package`parameter, etc)?
- Fpr bonus points: when running this test harness program on Travis, I use `cabal test -w `. How can I pick up the `` within this test harness (rather than using just `ghc` at line 79)?
Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.