Cabal's `main-is` field (source file) does not alter GHC's `-main-is` option (module and function name)
@mpilgrem ci sta già lavorando.
Dal 15/3/2025.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
If the module in main-is has a name and there is another module that has no explicit name (no module header), then the other module is picked as main module.
Bar.hs
main = putStrLn "I am the shady main..."
Foo.hs
module Foo where
main = putStrLn "I am the real main!"
wrong-main.cabal
cabal-version: 1.12
name: wrong-main
version: 0.0.0
build-type: Simple
executable wrong-main
main-is: Foo.hs
other-modules:
Bar
Paths_wrong_main
hs-source-dirs:
./
build-depends:
base
default-language: Haskell2010
$ stack run
...
I am the shady main...
Packaged reproducer: wrong-main.tgz
The wrong result can be reproduced with this vanilla GHC call:
ghc --make Foo.hs Bar.hs
The correct result can be obtained by adding -main-is Foo:
ghc --make -main-is Foo Bar.hs Foo.hs
I suppose the difficulty is to extract the module name Foo from Foo.hs, since -main-is does not accept a file, just a qualified (module) name.
This issue is shared with cabal:
- Lingua principale
- Haskell
- Stelle
- 4.1k
- Fork
- 857
- Merge medio
- 17h 32m
- PR unite (30g)
- 5
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di commercialhaskell/stack
-
Build Stack against Cabal >= 3.18Forse già presa @mpilgrem l’ha presa 14 giorni fa. Aperta
commercialhaskell/stack#6976 · 1 assegnatario ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
commercialhaskell/stack#6954 ·
-
Support type-checking without compilingForse di nuovo libera @mpilgrem l’ha presa 135 giorni fa e non c’è nessuna pull request aperta. Apertacomponent: build type: enhancement
commercialhaskell/stack#6951 · 3 reazioni · 1 assegnatario ·
-
Support semaphore-compat 2.0.0Forse di nuovo libera @mpilgrem l’ha presa 158 giorni fa e non c’è nessuna pull request aperta. Apertacomponent: build in progress type: enhancement
commercialhaskell/stack#6934 · 3 commenti · 1 assegnatario ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
commercialhaskell/stack#6864 · 1 commento ·
Tutte le issue di commercialhaskell/stack
Issue simili
-
documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
alunduil/network-arbitrary#293 ·
I maintainer di solito rispondono entro 1 giorno
-
area:client bug priority-low
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
bug triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 91/100
simplex-chat/simplex-chat#8372 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
compiler-explorer/compiler-explorer#9710 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno