diff --git a/cabal-install/src/Distribution/Client/Init/Defaults.hs b/cabal-install/src/Distribution/Client/Init/Defaults.hs index a915a5159d3..3852bf835bf 100644 --- a/cabal-install/src/Distribution/Client/Init/Defaults.hs +++ b/cabal-install/src/Distribution/Client/Init/Defaults.hs @@ -165,7 +165,7 @@ myLibHs = myExeHs :: [String] myExeHs = - [ "module Main where" + [ "module Main (main) where" , "" , "main :: IO ()" , "main = putStrLn \"Hello, Haskell!\"" @@ -173,7 +173,7 @@ myExeHs = myLibExeHs :: [String] myLibExeHs = - [ "module Main where" + [ "module Main (main) where" , "" , "import qualified MyLib (someFunc)" , "" diff --git a/changelog.d/pr-9890 b/changelog.d/pr-9890 new file mode 100644 index 00000000000..e9861aed7af --- /dev/null +++ b/changelog.d/pr-9890 @@ -0,0 +1,10 @@ +synopsis: `cabal init` generates explicit export lists for Main +packages: cabal-install +prs: #9890 +issues: #9889 + +description: { + +- Lack of explicit export list can degrade performance. The `Main` module in particular should always have an explicit export list that contains just the main function. Then, the compiler can do more aggressive optimizations on all the other non-exported functions. + +}