Skip to content

Commit b72ea91

Browse files
committed
Support GHC2024 (fixes #9736)
1 parent 2269835 commit b72ea91

File tree

9 files changed

+35
-6
lines changed

9 files changed

+35
-6
lines changed

Cabal-syntax/src/Language/Haskell/Extension.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ data Language
5454
| -- | The GHC2021 collection of language extensions.
5555
-- <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0380-ghc2021.rst>
5656
GHC2021
57+
| -- | The GHC2024 collection of language extensions.
58+
-- <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0613-ghc2024.rst>
59+
GHC2024
5760
| -- | An unknown language, identified by its name.
5861
UnknownLanguage String
5962
deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)
@@ -65,7 +68,7 @@ instance NFData Language where rnf = genericRnf
6568

6669
-- | List of known (supported) languages for GHC, oldest first.
6770
knownLanguages :: [Language]
68-
knownLanguages = [Haskell98, Haskell2010, GHC2021]
71+
knownLanguages = [Haskell98, Haskell2010, GHC2021, GHC2024]
6972

7073
instance Pretty Language where
7174
pretty (UnknownLanguage other) = Disp.text other

Cabal/src/Distribution/Simple/GHC/ImplInfo.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ data GhcImplInfo = GhcImplInfo
3838
-- ^ -XHaskell2010 and -XHaskell98 flags
3939
, supportsGHC2021 :: Bool
4040
-- ^ -XGHC2021 flag
41+
, supportsGHC2024 :: Bool
42+
-- ^ -XGHC2024 flag
4143
, reportsNoExt :: Bool
4244
-- ^ --supported-languages gives Ext and NoExt
4345
, alwaysNondecIndent :: Bool
@@ -88,6 +90,7 @@ ghcVersionImplInfo ver =
8890
GhcImplInfo
8991
{ supportsHaskell2010 = v >= [7]
9092
, supportsGHC2021 = v >= [9, 1]
93+
, supportsGHC2024 = v >= [9, 9]
9194
, reportsNoExt = v >= [7]
9295
, alwaysNondecIndent = v < [7, 1]
9396
, flagGhciScript = v >= [7, 2]
@@ -114,6 +117,7 @@ ghcjsVersionImplInfo _ghcjsver ghcver =
114117
GhcImplInfo
115118
{ supportsHaskell2010 = True
116119
, supportsGHC2021 = True
120+
, supportsGHC2024 = ghcv >= [9, 9]
117121
, reportsNoExt = True
118122
, alwaysNondecIndent = False
119123
, flagGhciScript = True

Cabal/src/Distribution/Simple/GHC/Internal.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,13 @@ getLanguages
258258
-> IO [(Language, String)]
259259
getLanguages _ implInfo _
260260
-- TODO: should be using --supported-languages rather than hard coding
261+
| supportsGHC2024 implInfo =
262+
return
263+
[ (GHC2024, "-XGHC2024")
264+
, (GHC2021, "-XGHC2021")
265+
, (Haskell2010, "-XHaskell2010")
266+
, (Haskell98, "-XHaskell98")
267+
]
261268
| supportsGHC2021 implInfo =
262269
return
263270
[ (GHC2021, "-XGHC2021")

cabal-install/src/Distribution/Client/Init/Interactive/Command.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,11 +456,12 @@ languagePrompt flags pkgType = getLanguage flags $ do
456456
let h2010 = "Haskell2010"
457457
h98 = "Haskell98"
458458
ghc2021 = "GHC2021 (requires at least GHC 9.2)"
459+
ghc2024 = "GHC2024 (requires at least GHC 9.10)"
459460

460461
l <-
461462
promptList
462463
("Choose a language for your " ++ pkgType)
463-
[h2010, h98, ghc2021]
464+
[h2010, h98, ghc2021, ghc2024]
464465
(DefaultPrompt h2010)
465466
Nothing
466467
True
@@ -469,6 +470,7 @@ languagePrompt flags pkgType = getLanguage flags $ do
469470
| l == h2010 -> return Haskell2010
470471
| l == h98 -> return Haskell98
471472
| l == ghc2021 -> return GHC2021
473+
| l == ghc2024 -> return GHC2024
472474
| otherwise -> return $ UnknownLanguage l
473475

474476
noCommentsPrompt :: Interactive m => InitFlags -> m Bool

cabal-install/tests/UnitTests/Distribution/Client/Init/Interactive.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ interactiveTests srcDb =
10141014
[ testNumberedPrompt
10151015
"Language indices"
10161016
(`languagePrompt` "test")
1017-
[Haskell2010, Haskell98, GHC2021]
1017+
[Haskell2010, Haskell98, GHC2021, GHC2024]
10181018
, testSimplePrompt
10191019
"Other language"
10201020
(`languagePrompt` "test")

changelog.d/issue-9736

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
synopsis: Add support for `GHC2024`
2+
packages: Cabal cabal-install
3+
issues: #9736
4+
5+
description: {
6+
7+
Support for the `GHC2024` language edition, introduced by GHC 9.10, has been
8+
added. It can now be used in the `default-language` and `other-languages`
9+
fields, and will be offered as an option by `cabal init`.
10+
11+
}

doc/buildinfo-fields-reference.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ default-language
290290
* Documentation of :pkg-field:`library:default-language`
291291

292292
.. math::
293-
\left\{ \mathop{\mathord{``}\mathtt{GHC2021}\mathord{"}}\mid\mathop{\mathord{``}\mathtt{Haskell2010}\mathord{"}}\mid\mathop{\mathord{``}\mathtt{Haskell98}\mathord{"}} \right\}
293+
\left\{ \mathop{\mathord{``}\mathtt{GHC2024}\mathord{"}}\mid\mathop{\mathord{``}\mathtt{GHC2021}\mathord{"}}\mid\mathop{\mathord{``}\mathtt{Haskell2010}\mathord{"}}\mid\mathop{\mathord{``}\mathtt{Haskell98}\mathord{"}} \right\}
294294
295295
extensions
296296
* Monoidal field
@@ -494,7 +494,7 @@ other-languages
494494
* Documentation of :pkg-field:`library:other-languages`
495495

496496
.. math::
497-
\mathrm{optcommalist}\left\{ \mathop{\mathord{``}\mathtt{GHC2021}\mathord{"}}\mid\mathop{\mathord{``}\mathtt{Haskell2010}\mathord{"}}\mid\mathop{\mathord{``}\mathtt{Haskell98}\mathord{"}} \right\}
497+
\mathrm{optcommalist}\left\{ \mathop{\mathord{``}\mathtt{GHC2024}\mathord{"}}\mid\mathop{\mathord{``}\mathtt{GHC2021}\mathord{"}}\mid\mathop{\mathord{``}\mathtt{Haskell2010}\mathord{"}}\mid\mathop{\mathord{``}\mathtt{Haskell98}\mathord{"}} \right\}
498498
499499
other-modules
500500
* Monoidal field

doc/cabal-package-description-file.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1730,7 +1730,8 @@ system-dependent values for these fields.
17301730

17311731
The possible values are:
17321732

1733-
- ``GHC2021`` (only available for GHC version newer than ``9.2``)
1733+
- ``GHC2024`` (only available for GHC version ``9.10`` or later)
1734+
- ``GHC2021`` (only available for GHC version ``9.2`` or later)
17341735
- ``Haskell2010``
17351736
- ``Haskell98``
17361737

editors/vim/syntax/cabal.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ syn keyword cabalLanguage contained
3939
\ Haskell98
4040
\ Haskell2010
4141
\ GHC2021
42+
\ GHC2024
4243

4344
" To update this in Cabal, `cabal repl Cabal` and:
4445
" >>> :m *Distribution.PackageDescription.FieldGrammar

0 commit comments

Comments
 (0)