Skip to content

Commit 55ccc0a

Browse files
noughtmareulysses4evermergify[bot]
authored
Explicit export lists for Main (#9890)
* Explicit export lists for Main 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. * add changelog --------- Co-authored-by: Artem Pelenitsyn <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent da40ea6 commit 55ccc0a

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

cabal-install/src/Distribution/Client/Init/Defaults.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,15 @@ myLibHs =
165165

166166
myExeHs :: [String]
167167
myExeHs =
168-
[ "module Main where"
168+
[ "module Main (main) where"
169169
, ""
170170
, "main :: IO ()"
171171
, "main = putStrLn \"Hello, Haskell!\""
172172
]
173173

174174
myLibExeHs :: [String]
175175
myLibExeHs =
176-
[ "module Main where"
176+
[ "module Main (main) where"
177177
, ""
178178
, "import qualified MyLib (someFunc)"
179179
, ""

changelog.d/pr-9890

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
synopsis: `cabal init` generates explicit export lists for Main
2+
packages: cabal-install
3+
prs: #9890
4+
issues: #9889
5+
6+
description: {
7+
8+
- 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.
9+
10+
}

0 commit comments

Comments
 (0)