Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chaging the default cabal spec in cabal init from 3.0 to 3.4 #8977

Open
Kleidukos opened this issue May 29, 2023 · 4 comments
Open

Chaging the default cabal spec in cabal init from 3.0 to 3.4 #8977

Kleidukos opened this issue May 29, 2023 · 4 comments

Comments

@Kleidukos
Copy link
Member

I'd like to suggest that we update the default spec that is suggested to the user upon cabal init.

Currently the user is offered

    1. 3.0 (+ set notation for ==, common stanzas in ifs, more redundant commas, better pkgconfig-depends)

by default, but has to manually input

  1. 3.4 (+ sublibraries in 'mixins', optional 'default-language')

in order to enjoy the same things + the additions of 3.4.

@Kleidukos
Copy link
Member Author

Kleidukos commented May 29, 2023

Unless I'm missing something big, the change looks like this:

diff --git a/cabal-install/src/Distribution/Client/Init/Defaults.hs b/cabal-install/src/Distribution/Client/Init/Defaults.hs
index 8a695d7de..6a17daa81 100644
--- a/cabal-install/src/Distribution/Client/Init/Defaults.hs
+++ b/cabal-install/src/Distribution/Client/Init/Defaults.hs
@@ -68,7 +68,7 @@ defaultTestDir :: String
 defaultTestDir = "test"

 defaultCabalVersion :: CabalSpecVersion
-defaultCabalVersion = CabalSpecV3_0
+defaultCabalVersion = CabalSpecV3_4

 defaultPackageType :: PackageType
 defaultPackageType = Executable
diff --git a/cabal-install/src/Distribution/Client/Init/Interactive/Command.hs b/cabal-install/src/Distribution/Client/Init/Interactive/Command.hs
index bf27eb301..34396e0f1 100644
--- a/cabal-install/src/Distribution/Client/Init/Interactive/Command.hs
+++ b/cabal-install/src/Distribution/Client/Init/Interactive/Command.hs
@@ -282,7 +282,7 @@ cabalVersionPrompt flags = getCabalVersion flags $ do
     parseCabalVersion "2.4" = CabalSpecV2_4
     parseCabalVersion "3.0" = CabalSpecV3_0
     parseCabalVersion "3.4" = CabalSpecV3_4
-    parseCabalVersion _ = defaultCabalVersion -- 2.4
+    parseCabalVersion _ = defaultCabalVersion -- 3.4

     displayCabalVersion :: CabalSpecVersion -> String
     displayCabalVersion v = case v of

(you'll note that the comment on parseCabalVersion _ = defaultCabalVersion hadn't been updated in quite some time.)

@Kleidukos Kleidukos self-assigned this May 29, 2023
@andreabedini
Copy link
Collaborator

Is there a reason why cabal init should not always use the latest version by default?

@Kleidukos
Copy link
Member Author

Perhaps if Hackage is not up-to-date between the latest version and the creation of a new package with the new spec. Beyond that I do not think I see other reasons.

@ulysses4ever
Copy link
Collaborator

Thank you for taking this!

It should be latest, see #8616

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants