You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cabal init does not always generate explicit export lists. Export lists can be important for performance. Especially the Main module should always have an explicit export list that just exports the main function.
To Reproduce
Steps to reproduce the behavior:
$ cabal init -mnq --exe
(--libandexe has the same problem)
That generates:
module Main where
main :: IO ()
main = putStrLn "Hello, Haskell"
Expected behavior
It should generate:
module Main (main) where
main :: IO ()
main = putStrLn "Hello, Haskell"
System information
NixOS 24.05pre606852.fd281bd6b7d3 (Uakari)
cabal-install version 3.10.2.1
compiled using version 3.10.1.0 of the Cabal library
The Glorious Glasgow Haskell Compilation System, version 9.6.4
The text was updated successfully, but these errors were encountered:
Hello and thanks for reporting! Not sure if it's useful to have the export list in Main specifically. But I guess if there's energy to fix it, that would be fine.
Not sure if it's useful to have the export list in Main specifically.
It is especially important to add an export list to the main module, because it only has to export main and GHC can do more aggressive optimizations on all the other non-exported functions.
I still think omission of the explicit export list on the main module is a performance bug.
Is it even possible to import the Main module in another module? Even if that is possible, I think we can agree that 99% of packages don't do that. So I don't see the harm.
Describe the bug
cabal init does not always generate explicit export lists. Export lists can be important for performance. Especially the
Main
module should always have an explicit export list that just exports themain
function.To Reproduce
Steps to reproduce the behavior:
(
--libandexe
has the same problem)That generates:
Expected behavior
It should generate:
System information
The text was updated successfully, but these errors were encountered: