From 00835c0759187b0fd27f3639d2c85cc96d80c83c Mon Sep 17 00:00:00 2001
From: Mario <blamario@protonmail.com>
Date: Fri, 12 Apr 2024 06:51:25 -0400
Subject: [PATCH] Registered the NamedDefaults language extension (#9740)

* Registered the NamedDefaults language extension

* Added changelog and Vim configuration lines

* Updated the expected hashes

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
---
 Cabal-syntax/src/Language/Haskell/Extension.hs           | 3 +++
 .../tests/UnitTests/Distribution/Utils/Structured.hs     | 8 ++++----
 changelog.d/pr-9740                                      | 9 +++++++++
 editors/vim/syntax/cabal.vim                             | 2 ++
 4 files changed, 18 insertions(+), 4 deletions(-)
 create mode 100644 changelog.d/pr-9740

diff --git a/Cabal-syntax/src/Language/Haskell/Extension.hs b/Cabal-syntax/src/Language/Haskell/Extension.hs
index 448b1d777c..22082d6d0b 100644
--- a/Cabal-syntax/src/Language/Haskell/Extension.hs
+++ b/Cabal-syntax/src/Language/Haskell/Extension.hs
@@ -303,6 +303,9 @@ data KnownExtension
   | -- | Allow default instantiation of polymorphic types in more
     -- situations.
     ExtendedDefaultRules
+  | -- | Allow @default@ declarations to explicitly name the class and
+    -- be exported.
+    NamedDefaults
   | -- | Enable unboxed tuples.
     UnboxedTuples
   | -- | Enable @deriving@ for classes 'Data.Typeable.Typeable' and
diff --git a/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs b/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs
index 71653353f9..2bc8e20666 100644
--- a/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs
+++ b/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs
@@ -33,15 +33,15 @@ md5Check proxy md5Int = structureHash proxy @?= md5FromInteger md5Int
 md5CheckGenericPackageDescription :: Proxy GenericPackageDescription -> Assertion
 md5CheckGenericPackageDescription proxy = md5Check proxy
 #if MIN_VERSION_base(4,19,0)
-    0x5a48c6570cbcf96af4c51f38962e37b5
+    0x6639f65b143830a97e9c4f448b9cabb0
 #else
-    0xc5c0e54b95e651216e92db04c9cd4ecf
+    0x855933700dccfbcc1d642e3470c3702c
 #endif
 
 md5CheckLocalBuildInfo :: Proxy LocalBuildInfo -> Assertion
 md5CheckLocalBuildInfo proxy = md5Check proxy
 #if MIN_VERSION_base(4,19,0)
-    0x6d668de33d7b4d5df3830e65e6941373
+    0x2ae73730f60c7c947e2cb63c4aac1e54
 #else
-    0xcdf740970a7d37e5e7ca48ea5f4f25eb7
+    0x906cbfdef0bcdfe5734499cfabc615f5
 #endif
diff --git a/changelog.d/pr-9740 b/changelog.d/pr-9740
new file mode 100644
index 0000000000..c5a3b9a173
--- /dev/null
+++ b/changelog.d/pr-9740
@@ -0,0 +1,9 @@
+synopsis: Add language extension NamedDefaults
+packages: Cabal-syntax
+prs: #9740
+
+description: {
+
+- adds support for the `NamedDefaults` language extension (GHC proposal #409)
+
+}
diff --git a/editors/vim/syntax/cabal.vim b/editors/vim/syntax/cabal.vim
index 2e6361ba9c..119a5ccb76 100644
--- a/editors/vim/syntax/cabal.vim
+++ b/editors/vim/syntax/cabal.vim
@@ -221,6 +221,7 @@ syn keyword cabalExtension contained
   \ MultiParamTypeClasses
   \ MultiWayIf
   \ NPlusKPatterns
+  \ NamedDefaults
   \ NamedFieldPuns
   \ NamedWildCards
   \ NegativeLiterals
@@ -362,6 +363,7 @@ syn keyword cabalExtension contained
   \ NoMultiParamTypeClasses
   \ NoMultiWayIf
   \ NoNPlusKPatterns
+  \ NoNamedDefaults
   \ NoNamedFieldPuns
   \ NoNamedWildCards
   \ NoNegativeLiterals
-- 
GitLab