diff --git a/Cabal-syntax.cabal b/Cabal-syntax.cabal
--- a/Cabal-syntax.cabal
+++ b/Cabal-syntax.cabal
@@ -1,8 +1,8 @@
-cabal-version: 1.22
+cabal-version: 2.2
 name:          Cabal-syntax
-version:       3.8.1.0
-copyright:     2003-2022, Cabal Development Team (see AUTHORS file)
-license:       BSD3
+version:       3.10.1.0
+copyright:     2003-2023, Cabal Development Team (see AUTHORS file)
+license:       BSD-3-Clause
 license-file:  LICENSE
 author:        Cabal Development Team <cabal-devel@haskell.org>
 maintainer:    cabal-devel@haskell.org
@@ -29,31 +29,33 @@
 
   build-depends:
     array      >= 0.4.0.1  && < 0.6,
-    base       >= 4.6      && < 5,
+    base       >= 4.9      && < 5,
     binary     >= 0.7      && < 0.9,
     bytestring >= 0.10.0.0 && < 0.12,
     containers >= 0.5.0.0  && < 0.7,
     deepseq    >= 1.3.0.1  && < 1.5,
     directory  >= 1.2      && < 1.4,
     filepath   >= 1.3.0.1  && < 1.5,
-    mtl        >= 2.1      && < 2.3,
+    mtl        >= 2.1      && < 2.4,
     parsec     >= 3.1.13.0 && < 3.2,
     pretty     >= 1.1.1    && < 1.2,
     text       (>= 1.2.3.0 && < 1.3) || (>= 2.0 && < 2.1),
     time       >= 1.4.0.1  && < 1.13,
     -- transformers-0.4.0.0 doesn't have record syntax e.g. for Identity
     -- See also https://github.com/ekmett/transformers-compat/issues/35
-    transformers (>= 0.3      && < 0.4) || (>=0.4.1.0 && <0.6)
+    transformers (>= 0.3      && < 0.4) || (>=0.4.1.0 && <0.7)
 
   if os(windows)
     build-depends: Win32 >= 2.3.0.0 && < 2.14
   else
-    build-depends: unix  >= 2.6.0.0 && < 2.8
+    build-depends: unix  >= 2.6.0.0 && < 2.9
 
   ghc-options: -Wall -fno-ignore-asserts -fwarn-tabs -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates
-  ghc-options: -Wcompat -Wnoncanonical-monad-instances
 
-  if impl(ghc <8.8)
+  if impl(ghc >= 8.0)
+    ghc-options: -Wcompat -Wnoncanonical-monad-instances
+
+  if impl(ghc >= 8.0) && impl(ghc < 8.8)
     ghc-options: -Wnoncanonical-monadfail-instances
 
   exposed-modules:
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2003-2022, Cabal Development Team.
+Copyright (c) 2003-2023, Cabal Development Team.
 See the AUTHORS file for the full list of copyright holders.
 
 See */LICENSE for the copyright holders of the subcomponents.
diff --git a/src/Distribution/Backpack.hs b/src/Distribution/Backpack.hs
--- a/src/Distribution/Backpack.hs
+++ b/src/Distribution/Backpack.hs
@@ -98,7 +98,7 @@
 -- TODO: cache holes?
 
 instance Binary OpenUnitId
-instance Structured OpenUnitId 
+instance Structured OpenUnitId
 instance NFData OpenUnitId where
     rnf (IndefFullUnitId cid subst) = rnf cid `seq` rnf subst
     rnf (DefiniteUnitId uid) = rnf uid
diff --git a/src/Distribution/CabalSpecVersion.hs b/src/Distribution/CabalSpecVersion.hs
--- a/src/Distribution/CabalSpecVersion.hs
+++ b/src/Distribution/CabalSpecVersion.hs
@@ -30,6 +30,7 @@
     | CabalSpecV3_4
     | CabalSpecV3_6
     | CabalSpecV3_8
+    -- 3.10: no changes
   deriving (Eq, Ord, Show, Read, Enum, Bounded, Typeable, Data, Generic)
 
 instance Binary CabalSpecVersion
diff --git a/src/Distribution/Compiler.hs b/src/Distribution/Compiler.hs
--- a/src/Distribution/Compiler.hs
+++ b/src/Distribution/Compiler.hs
@@ -125,7 +125,7 @@
 -- Cabal parses only @ghc-options@ and @ghcjs-options@, others are omitted.
 --
 data PerCompilerFlavor v = PerCompilerFlavor v v
-  deriving (Generic, Show, Read, Eq, Typeable, Data, Functor, Foldable
+  deriving (Generic, Show, Read, Eq, Ord, Typeable, Data, Functor, Foldable
            , Traversable)
 
 instance Binary a => Binary (PerCompilerFlavor a)
diff --git a/src/Distribution/Fields/Pretty.hs b/src/Distribution/Fields/Pretty.hs
--- a/src/Distribution/Fields/Pretty.hs
+++ b/src/Distribution/Fields/Pretty.hs
@@ -34,7 +34,7 @@
 import qualified Data.ByteString  as BS
 import qualified Text.PrettyPrint as PP
 
--- | This type is used to discern when a comment block should go 
+-- | This type is used to discern when a comment block should go
 --   before or after a cabal-like file field, otherwise it would
 --   be hardcoded to a single position. It is often used in
 --   conjunction with @PrettyField@.
@@ -153,7 +153,7 @@
     narrowStyle = PP.style { PP.lineLength = PP.lineLength PP.style - fw }
 
 renderField opts@(Opts rann indent post) _ (PrettySection ann name args fields) = Block Margin Margin $
-    
+
     attachComments
       (post ann [ PP.render $ PP.hsep $ PP.text (fromUTF8BS name) : args ])
     ++
diff --git a/src/Distribution/License.hs b/src/Distribution/License.hs
--- a/src/Distribution/License.hs
+++ b/src/Distribution/License.hs
@@ -125,7 +125,7 @@
 
     -- | Indicates an erroneous license name.
   | UnknownLicense String
-  deriving (Generic, Read, Show, Eq, Typeable, Data)
+  deriving (Generic, Read, Show, Eq, Ord, Typeable, Data)
 
 instance Binary License
 instance Structured License
diff --git a/src/Distribution/PackageDescription/FieldGrammar.hs b/src/Distribution/PackageDescription/FieldGrammar.hs
--- a/src/Distribution/PackageDescription/FieldGrammar.hs
+++ b/src/Distribution/PackageDescription/FieldGrammar.hs
@@ -6,6 +6,8 @@
 module Distribution.PackageDescription.FieldGrammar (
     -- * Package description
     packageDescriptionFieldGrammar,
+    CompatFilePath(..),
+    CompatLicenseFile(..),
     -- * Library
     libraryFieldGrammar,
     -- * Foreign library
diff --git a/src/Distribution/PackageDescription/Quirks.hs b/src/Distribution/PackageDescription/Quirks.hs
--- a/src/Distribution/PackageDescription/Quirks.hs
+++ b/src/Distribution/PackageDescription/Quirks.hs
@@ -37,7 +37,7 @@
     [ mk "-- This file has been generated from package.yaml by hpack version 0.17.0.\n--\n-- see: https://github.com/sol/hpack\n\nname:                unicode-transforms\nversion:             0.3.3\nsynopsis:            Unicode normalization\ndescription:         Fast Unic"
          (Fingerprint 15958160436627155571 10318709190730872881)
          (Fingerprint 11008465475756725834 13815629925116264363)
-         (bsRemove "  other-modules:\n      .\n") -- TODO: remove traling \n to test structural-diff
+         (bsRemove "  other-modules:\n      .\n") -- TODO: remove trailing \n to test structural-diff
     -- http://hackage.haskell.org/package/DSTM-0.1.2
     -- http://hackage.haskell.org/package/DSTM-0.1.1
     -- http://hackage.haskell.org/package/DSTM-0.1
diff --git a/src/Distribution/Parsec/Warning.hs b/src/Distribution/Parsec/Warning.hs
--- a/src/Distribution/Parsec/Warning.hs
+++ b/src/Distribution/Parsec/Warning.hs
@@ -51,7 +51,7 @@
 
 -- | Parser warning.
 data PWarning = PWarning !PWarnType !Position String
-    deriving (Show, Generic)
+    deriving (Eq, Ord, Show, Generic)
 
 instance Binary PWarning
 instance NFData PWarning where rnf = genericRnf
diff --git a/src/Distribution/SPDX/LicenseExceptionId.hs b/src/Distribution/SPDX/LicenseExceptionId.hs
--- a/src/Distribution/SPDX/LicenseExceptionId.hs
+++ b/src/Distribution/SPDX/LicenseExceptionId.hs
@@ -29,7 +29,7 @@
 -- LicenseExceptionId
 -------------------------------------------------------------------------------
 
--- | SPDX License Exceptions identifiers list v3.16 
+-- | SPDX License Exceptions identifiers list v3.16
 data LicenseExceptionId
     = DS389_exception -- ^ @389-exception@, 389 Directory Server Exception
     | Autoconf_exception_2_0 -- ^ @Autoconf-exception-2.0@, Autoconf exception 2.0
diff --git a/src/Distribution/SPDX/LicenseId.hs b/src/Distribution/SPDX/LicenseId.hs
--- a/src/Distribution/SPDX/LicenseId.hs
+++ b/src/Distribution/SPDX/LicenseId.hs
@@ -32,7 +32,7 @@
 -- LicenseId
 -------------------------------------------------------------------------------
 
--- | SPDX License identifiers list v3.16 
+-- | SPDX License identifiers list v3.16
 data LicenseId
     = NullBSD -- ^ @0BSD@, BSD Zero Clause License
     | AAL -- ^ @AAL@, Attribution Assurance License
diff --git a/src/Distribution/Types/AbiHash.hs b/src/Distribution/Types/AbiHash.hs
--- a/src/Distribution/Types/AbiHash.hs
+++ b/src/Distribution/Types/AbiHash.hs
@@ -27,18 +27,18 @@
 newtype AbiHash = AbiHash ShortText
     deriving (Eq, Show, Read, Generic, Typeable)
 
+-- | Convert 'AbiHash' to 'String'
+--
+-- @since 2.0.0.2
+unAbiHash :: AbiHash -> String
+unAbiHash (AbiHash h) = fromShortText h
+
 -- | Construct a 'AbiHash' from a 'String'
 --
 -- 'mkAbiHash' is the inverse to 'unAbiHash'
 --
 -- Note: No validations are performed to ensure that the resulting
 -- 'AbiHash' is valid
---
--- @since 2.0.0.2
-unAbiHash :: AbiHash -> String
-unAbiHash (AbiHash h) = fromShortText h
-
--- | Convert 'AbiHash' to 'String'
 --
 -- @since 2.0.0.2
 mkAbiHash :: String -> AbiHash
diff --git a/src/Distribution/Types/Benchmark.hs b/src/Distribution/Types/Benchmark.hs
--- a/src/Distribution/Types/Benchmark.hs
+++ b/src/Distribution/Types/Benchmark.hs
@@ -28,7 +28,7 @@
         benchmarkInterface :: BenchmarkInterface,
         benchmarkBuildInfo :: BuildInfo
     }
-    deriving (Generic, Show, Read, Eq, Typeable, Data)
+    deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)
 
 instance Binary Benchmark
 instance Structured Benchmark
diff --git a/src/Distribution/Types/BenchmarkInterface.hs b/src/Distribution/Types/BenchmarkInterface.hs
--- a/src/Distribution/Types/BenchmarkInterface.hs
+++ b/src/Distribution/Types/BenchmarkInterface.hs
@@ -21,8 +21,8 @@
      -- | Benchmark interface \"exitcode-stdio-1.0\". The benchmark
      -- takes the form of an executable. It returns a zero exit code
      -- for success, non-zero for failure. The stdout and stderr
-     -- channels may be logged. It takes no command line parameters
-     -- and nothing on stdin.
+     -- channels may be logged. Test tooling may pass command line
+     -- arguments and/or connect the stdin channel to the test.
      --
      BenchmarkExeV10 Version FilePath
 
@@ -30,7 +30,7 @@
      -- interfaces for the given reason (e.g. unknown benchmark type).
      --
    | BenchmarkUnsupported BenchmarkType
-   deriving (Eq, Generic, Read, Show, Typeable, Data)
+   deriving (Eq, Ord, Generic, Read, Show, Typeable, Data)
 
 instance Binary BenchmarkInterface
 instance Structured BenchmarkInterface
diff --git a/src/Distribution/Types/BenchmarkType.hs b/src/Distribution/Types/BenchmarkType.hs
--- a/src/Distribution/Types/BenchmarkType.hs
+++ b/src/Distribution/Types/BenchmarkType.hs
@@ -22,7 +22,7 @@
                      -- ^ \"type: exitcode-stdio-x.y\"
                    | BenchmarkTypeUnknown String Version
                      -- ^ Some unknown benchmark type e.g. \"type: foo\"
-    deriving (Generic, Show, Read, Eq, Typeable, Data)
+    deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)
 
 instance Binary BenchmarkType
 instance Structured BenchmarkType
diff --git a/src/Distribution/Types/BuildInfo.hs b/src/Distribution/Types/BuildInfo.hs
--- a/src/Distribution/Types/BuildInfo.hs
+++ b/src/Distribution/Types/BuildInfo.hs
@@ -110,7 +110,7 @@
         targetBuildDepends :: [Dependency], -- ^ Dependencies specific to a library or executable target
         mixins :: [Mixin]
     }
-    deriving (Generic, Show, Read, Eq, Typeable, Data)
+    deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)
 
 instance Binary BuildInfo
 instance Structured BuildInfo
diff --git a/src/Distribution/Types/BuildType.hs b/src/Distribution/Types/BuildType.hs
--- a/src/Distribution/Types/BuildType.hs
+++ b/src/Distribution/Types/BuildType.hs
@@ -25,7 +25,7 @@
                 -- information used by later phases.
   | Make        -- ^ calls @Distribution.Make.defaultMain@
   | Custom      -- ^ uses user-supplied @Setup.hs@ or @Setup.lhs@ (default)
-                deriving (Generic, Show, Read, Eq, Typeable, Data)
+                deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)
 
 instance Binary BuildType
 instance Structured BuildType
diff --git a/src/Distribution/Types/ComponentName.hs b/src/Distribution/Types/ComponentName.hs
--- a/src/Distribution/Types/ComponentName.hs
+++ b/src/Distribution/Types/ComponentName.hs
@@ -1,9 +1,11 @@
 {-# LANGUAGE DeriveDataTypeable #-}
 {-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE PatternSynonyms #-}
 
 module Distribution.Types.ComponentName (
-  ComponentName(..),
+  ComponentName(.., CFLibName, CExeName, CTestName, CBenchName),
   showComponentName,
+  componentNameRaw,
   componentNameStanza,
   componentNameString,
   ) where
@@ -21,12 +23,32 @@
 
 -- Libraries live in a separate namespace, so must distinguish
 data ComponentName = CLibName   LibraryName
-                   | CFLibName  UnqualComponentName
-                   | CExeName   UnqualComponentName
-                   | CTestName  UnqualComponentName
-                   | CBenchName UnqualComponentName
+                   | CNotLibName NotLibComponentName
                    deriving (Eq, Generic, Ord, Read, Show, Typeable)
 
+data NotLibComponentName
+                   = CNLFLibName  { toCompName :: UnqualComponentName }
+                   | CNLExeName   { toCompName :: UnqualComponentName }
+                   | CNLTestName  { toCompName :: UnqualComponentName }
+                   | CNLBenchName { toCompName :: UnqualComponentName }
+                   deriving (Eq, Generic, Ord, Read, Show, Typeable)
+
+pattern CFLibName :: UnqualComponentName -> ComponentName
+pattern CFLibName  n = CNotLibName (CNLFLibName  n)
+
+pattern CExeName :: UnqualComponentName -> ComponentName
+pattern CExeName   n = CNotLibName (CNLExeName   n)
+
+pattern CTestName :: UnqualComponentName -> ComponentName
+pattern CTestName  n = CNotLibName (CNLTestName  n)
+
+pattern CBenchName :: UnqualComponentName -> ComponentName
+pattern CBenchName n = CNotLibName (CNLBenchName n)
+{-# COMPLETE CLibName, CFLibName, CExeName, CTestName, CBenchName #-}
+
+instance Binary NotLibComponentName
+instance Structured NotLibComponentName
+
 instance Binary ComponentName
 instance Structured ComponentName
 
@@ -59,6 +81,10 @@
 showComponentName (CTestName  name) = "test suite '" ++ prettyShow name ++ "'"
 showComponentName (CBenchName name) = "benchmark '" ++ prettyShow name ++ "'"
 
+componentNameRaw :: ComponentName -> String
+componentNameRaw l@(CLibName  _) = showComponentName l
+componentNameRaw (CNotLibName x) = prettyShow $ toCompName x
+
 componentNameStanza :: ComponentName -> String
 componentNameStanza (CLibName lib)    = libraryNameStanza lib
 componentNameStanza (CFLibName  name) = "foreign-library " ++ prettyShow name
@@ -71,8 +97,5 @@
 -- @Nothing@ if the 'ComponentName' was for the public
 -- library.
 componentNameString :: ComponentName -> Maybe UnqualComponentName
-componentNameString (CLibName lib) = libraryNameString lib
-componentNameString (CFLibName  n) = Just n
-componentNameString (CExeName   n) = Just n
-componentNameString (CTestName  n) = Just n
-componentNameString (CBenchName n) = Just n
+componentNameString (CLibName  lib) = libraryNameString lib
+componentNameString (CNotLibName x) = Just $ toCompName x
diff --git a/src/Distribution/Types/CondTree.hs b/src/Distribution/Types/CondTree.hs
--- a/src/Distribution/Types/CondTree.hs
+++ b/src/Distribution/Types/CondTree.hs
diff --git a/src/Distribution/Types/Condition.hs b/src/Distribution/Types/Condition.hs
--- a/src/Distribution/Types/Condition.hs
+++ b/src/Distribution/Types/Condition.hs
@@ -26,7 +26,7 @@
 cNot (CNot c) = c
 cNot c        = CNot c
 
--- | Boolean AND of two 'Condtion' values.
+-- | Boolean AND of two 'Condition' values.
 cAnd :: Condition a -> Condition a -> Condition a
 cAnd (Lit False) _           = Lit False
 cAnd _           (Lit False) = Lit False
diff --git a/src/Distribution/Types/Dependency.hs b/src/Distribution/Types/Dependency.hs
--- a/src/Distribution/Types/Dependency.hs
+++ b/src/Distribution/Types/Dependency.hs
@@ -44,7 +44,7 @@
                     -- ^ The set of libraries required from the package.
                     -- Only the selected libraries will be built.
                     -- It does not affect the cabal-install solver yet.
-                  deriving (Generic, Read, Show, Eq, Typeable, Data)
+                  deriving (Generic, Read, Show, Eq, Ord, Typeable, Data)
 
 depPkgName :: Dependency -> PackageName
 depPkgName (Dependency pn _ _) = pn
diff --git a/src/Distribution/Types/ExeDependency.hs b/src/Distribution/Types/ExeDependency.hs
--- a/src/Distribution/Types/ExeDependency.hs
+++ b/src/Distribution/Types/ExeDependency.hs
@@ -24,7 +24,7 @@
                      PackageName
                      UnqualComponentName -- name of executable component of package
                      VersionRange
-                     deriving (Generic, Read, Show, Eq, Typeable, Data)
+                     deriving (Generic, Read, Show, Eq, Ord, Typeable, Data)
 
 instance Binary ExeDependency
 instance Structured ExeDependency
@@ -37,7 +37,7 @@
       pver | isAnyVersion ver = PP.empty
            | otherwise        = pretty ver
 
--- | 
+-- |
 --
 -- Examples
 --
diff --git a/src/Distribution/Types/Executable.hs b/src/Distribution/Types/Executable.hs
--- a/src/Distribution/Types/Executable.hs
+++ b/src/Distribution/Types/Executable.hs
@@ -24,7 +24,7 @@
         exeScope   :: ExecutableScope,
         buildInfo  :: BuildInfo
     }
-    deriving (Generic, Show, Read, Eq, Typeable, Data)
+    deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)
 
 instance L.HasBuildInfo Executable where
     buildInfo f l = (\x -> l { buildInfo = x }) <$> f (buildInfo l)
diff --git a/src/Distribution/Types/ExecutableScope.hs b/src/Distribution/Types/ExecutableScope.hs
--- a/src/Distribution/Types/ExecutableScope.hs
+++ b/src/Distribution/Types/ExecutableScope.hs
@@ -17,7 +17,7 @@
 
 data ExecutableScope = ExecutablePublic
                      | ExecutablePrivate
-    deriving (Generic, Show, Read, Eq, Typeable, Data)
+    deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)
 
 instance Pretty ExecutableScope where
     pretty ExecutablePublic       = Disp.text "public"
diff --git a/src/Distribution/Types/Flag.hs b/src/Distribution/Types/Flag.hs
--- a/src/Distribution/Types/Flag.hs
+++ b/src/Distribution/Types/Flag.hs
@@ -193,7 +193,7 @@
 
 -- | Insert or update the boolean value of a flag.
 --
--- If the flag is already present in the 'FlagAssigment', the
+-- If the flag is already present in the 'FlagAssignment', the
 -- value will be updated and the fact that multiple values have
 -- been provided for that flag will be recorded so that a
 -- warning can be generated later on.
diff --git a/src/Distribution/Types/ForeignLib.hs b/src/Distribution/Types/ForeignLib.hs
--- a/src/Distribution/Types/ForeignLib.hs
+++ b/src/Distribution/Types/ForeignLib.hs
@@ -60,7 +60,7 @@
       -- the condition trees (for instance, when creating an sdist)
     , foreignLibModDefFile :: [FilePath]
     }
-    deriving (Generic, Show, Read, Eq, Typeable, Data)
+    deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)
 
 data LibVersionInfo = LibVersionInfo Int Int Int deriving (Data, Eq, Generic, Typeable)
 
diff --git a/src/Distribution/Types/ForeignLibOption.hs b/src/Distribution/Types/ForeignLibOption.hs
--- a/src/Distribution/Types/ForeignLibOption.hs
+++ b/src/Distribution/Types/ForeignLibOption.hs
@@ -22,7 +22,7 @@
      -- This option is compulsory on Windows and unsupported
      -- on other platforms.
      ForeignLibStandalone
-    deriving (Generic, Show, Read, Eq, Typeable, Data)
+    deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)
 
 instance Pretty ForeignLibOption where
   pretty ForeignLibStandalone = Disp.text "standalone"
diff --git a/src/Distribution/Types/ForeignLibType.hs b/src/Distribution/Types/ForeignLibType.hs
--- a/src/Distribution/Types/ForeignLibType.hs
+++ b/src/Distribution/Types/ForeignLibType.hs
@@ -27,7 +27,7 @@
     | ForeignLibNativeStatic
       -- TODO: Maybe this should record a string?
     | ForeignLibTypeUnknown
-    deriving (Generic, Show, Read, Eq, Typeable, Data)
+    deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)
 
 instance Pretty ForeignLibType where
   pretty ForeignLibNativeShared = Disp.text "native-shared"
diff --git a/src/Distribution/Types/GenericPackageDescription.hs b/src/Distribution/Types/GenericPackageDescription.hs
--- a/src/Distribution/Types/GenericPackageDescription.hs
+++ b/src/Distribution/Types/GenericPackageDescription.hs
@@ -1,7 +1,6 @@
 {-# LANGUAGE DeriveDataTypeable #-}
 {-# LANGUAGE DeriveGeneric #-}
 {-# LANGUAGE FlexibleContexts #-}
-{-# LANGUAGE GeneralizedNewtypeDeriving #-}
 {-# LANGUAGE ScopedTypeVariables #-}
 
 module Distribution.Types.GenericPackageDescription (
@@ -86,7 +85,6 @@
             <*> (traverse . L._2 . traverseCondTreeBuildInfo) f x4
             <*> (traverse . L._2 . traverseCondTreeBuildInfo) f x5
             <*> (traverse . L._2 . traverseCondTreeBuildInfo) f x6
-      where
 
 -- We use this traversal to keep [Dependency] field in CondTree up to date.
 traverseCondTreeBuildInfo
@@ -94,7 +92,7 @@
     => LensLike' f (CondTree v [Dependency] comp) L.BuildInfo
 traverseCondTreeBuildInfo g = node where
     mkCondNode :: comp -> [CondBranch v [Dependency] comp] -> CondTree v [Dependency] comp
-    mkCondNode comp branches = CondNode comp (view L.targetBuildDepends comp) branches
+    mkCondNode comp = CondNode comp (view L.targetBuildDepends comp)
 
     node (CondNode comp _ branches) = mkCondNode
         <$> L.buildInfo g comp
diff --git a/src/Distribution/Types/LegacyExeDependency.hs b/src/Distribution/Types/LegacyExeDependency.hs
--- a/src/Distribution/Types/LegacyExeDependency.hs
+++ b/src/Distribution/Types/LegacyExeDependency.hs
@@ -24,7 +24,7 @@
 data LegacyExeDependency = LegacyExeDependency
                            String
                            VersionRange
-                         deriving (Generic, Read, Show, Eq, Typeable, Data)
+                         deriving (Generic, Read, Show, Eq, Ord, Typeable, Data)
 
 instance Binary LegacyExeDependency
 instance Structured LegacyExeDependency
diff --git a/src/Distribution/Types/Library.hs b/src/Distribution/Types/Library.hs
--- a/src/Distribution/Types/Library.hs
+++ b/src/Distribution/Types/Library.hs
@@ -25,10 +25,10 @@
     , reexportedModules :: [ModuleReexport]
     , signatures        :: [ModuleName]       -- ^ What sigs need implementations?
     , libExposed        :: Bool               -- ^ Is the lib to be exposed by default? (i.e. whether its modules available in GHCi for example)
-    , libVisibility     :: LibraryVisibility  -- ^ Whether this multilib can be dependent from outside.
+    , libVisibility     :: LibraryVisibility  -- ^ Whether this multilib can be used as a dependency for other packages.
     , libBuildInfo      :: BuildInfo
     }
-    deriving (Generic, Show, Eq, Read, Typeable, Data)
+    deriving (Generic, Show, Eq, Ord, Read, Typeable, Data)
 
 instance L.HasBuildInfo Library where
     buildInfo f l = (\x -> l { libBuildInfo = x }) <$> f (libBuildInfo l)
diff --git a/src/Distribution/Types/LibraryName.hs b/src/Distribution/Types/LibraryName.hs
--- a/src/Distribution/Types/LibraryName.hs
+++ b/src/Distribution/Types/LibraryName.hs
@@ -35,7 +35,7 @@
 --
 -- /Note:/ there are no 'Pretty' or 'Parsec' instances,
 -- as there's other way to represent 'LibraryName', namely as bare
--- 'UnqualComponentName'. 
+-- 'UnqualComponentName'.
 prettyLibraryNameComponent :: LibraryName -> Disp.Doc
 prettyLibraryNameComponent LMainLibName      = Disp.text "lib"
 prettyLibraryNameComponent (LSubLibName str) = Disp.text "lib:" <<>> pretty str
diff --git a/src/Distribution/Types/LibraryVisibility.hs b/src/Distribution/Types/LibraryVisibility.hs
--- a/src/Distribution/Types/LibraryVisibility.hs
+++ b/src/Distribution/Types/LibraryVisibility.hs
@@ -20,11 +20,11 @@
 -- @since 3.0.0.0
 --
 data LibraryVisibility
-      -- | Can be depenendent from other packages
+      -- | Can be used as a dependency for other packages
     = LibraryVisibilityPublic
       -- | Internal library, default
     | LibraryVisibilityPrivate
-    deriving (Generic, Show, Read, Eq, Typeable, Data)
+    deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)
 
 instance Pretty LibraryVisibility where
     pretty LibraryVisibilityPublic  = Disp.text "public"
diff --git a/src/Distribution/Types/Mixin.hs b/src/Distribution/Types/Mixin.hs
--- a/src/Distribution/Types/Mixin.hs
+++ b/src/Distribution/Types/Mixin.hs
@@ -78,7 +78,7 @@
     ]
 
 -- | Smart constructor of 'Mixin', enforces invariant.
--- 
+--
 -- @since 3.4.0.0
 mkMixin :: PackageName -> LibraryName -> IncludeRenaming -> Mixin
 mkMixin pn (LSubLibName uqn) incl
diff --git a/src/Distribution/Types/ModuleReexport.hs b/src/Distribution/Types/ModuleReexport.hs
--- a/src/Distribution/Types/ModuleReexport.hs
+++ b/src/Distribution/Types/ModuleReexport.hs
@@ -24,7 +24,7 @@
        moduleReexportOriginalName    :: ModuleName,
        moduleReexportName            :: ModuleName
     }
-    deriving (Eq, Generic, Read, Show, Typeable, Data)
+    deriving (Eq, Ord, Generic, Read, Show, Typeable, Data)
 
 instance Binary ModuleReexport
 instance Structured ModuleReexport
diff --git a/src/Distribution/Types/PackageDescription.hs b/src/Distribution/Types/PackageDescription.hs
--- a/src/Distribution/Types/PackageDescription.hs
+++ b/src/Distribution/Types/PackageDescription.hs
@@ -146,7 +146,7 @@
         extraTmpFiles  :: [FilePath],
         extraDocFiles  :: [FilePath]
     }
-    deriving (Generic, Show, Read, Eq, Typeable, Data)
+    deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)
 
 instance Binary PackageDescription
 instance Structured PackageDescription
diff --git a/src/Distribution/Types/PkgconfigDependency.hs b/src/Distribution/Types/PkgconfigDependency.hs
--- a/src/Distribution/Types/PkgconfigDependency.hs
+++ b/src/Distribution/Types/PkgconfigDependency.hs
@@ -21,7 +21,7 @@
 data PkgconfigDependency = PkgconfigDependency
                            PkgconfigName
                            PkgconfigVersionRange
-                         deriving (Generic, Read, Show, Eq, Typeable, Data)
+                         deriving (Generic, Read, Show, Eq, Ord, Typeable, Data)
 
 instance Binary PkgconfigDependency
 instance Structured PkgconfigDependency
diff --git a/src/Distribution/Types/PkgconfigVersion.hs b/src/Distribution/Types/PkgconfigVersion.hs
--- a/src/Distribution/Types/PkgconfigVersion.hs
+++ b/src/Distribution/Types/PkgconfigVersion.hs
@@ -53,7 +53,7 @@
         predicate c = isAsciiAlphaNum c || c == '.' || c == '-'
 
 -------------------------------------------------------------------------------
--- rmpvercmp - pure Haskell implementation
+-- rpmvercmp - pure Haskell implementation
 -------------------------------------------------------------------------------
 
 -- | Compare two version strings as @pkg-config@ would compare them.
@@ -115,5 +115,4 @@
 
 isAlpha8 :: Word8 -> Bool
 isAlpha8 w = (0x41 <= w && w <= 0x5A) || (0x61 <= w && w <= 0x7A)
-
 
diff --git a/src/Distribution/Types/PkgconfigVersionRange.hs b/src/Distribution/Types/PkgconfigVersionRange.hs
--- a/src/Distribution/Types/PkgconfigVersionRange.hs
+++ b/src/Distribution/Types/PkgconfigVersionRange.hs
@@ -35,7 +35,7 @@
   | PcOrEarlierVersion       PkgconfigVersion -- =< version
   | PcUnionVersionRanges     PkgconfigVersionRange PkgconfigVersionRange
   | PcIntersectVersionRanges PkgconfigVersionRange PkgconfigVersionRange
-  deriving (Generic, Read, Show, Eq, Typeable, Data)
+  deriving (Generic, Read, Show, Eq, Ord, Typeable, Data)
 
 instance Binary PkgconfigVersionRange
 instance Structured PkgconfigVersionRange
diff --git a/src/Distribution/Types/SetupBuildInfo.hs b/src/Distribution/Types/SetupBuildInfo.hs
--- a/src/Distribution/Types/SetupBuildInfo.hs
+++ b/src/Distribution/Types/SetupBuildInfo.hs
@@ -25,7 +25,7 @@
         -- internally, and doesn't correspond to anything in the .cabal
         -- file. See #3199.
     }
-    deriving (Generic, Show, Eq, Read, Typeable, Data)
+    deriving (Generic, Show, Eq, Ord, Read, Typeable, Data)
 
 instance Binary SetupBuildInfo
 instance Structured SetupBuildInfo
diff --git a/src/Distribution/Types/TestSuite.hs b/src/Distribution/Types/TestSuite.hs
--- a/src/Distribution/Types/TestSuite.hs
+++ b/src/Distribution/Types/TestSuite.hs
@@ -29,7 +29,7 @@
         testBuildInfo :: BuildInfo,
         testCodeGenerators :: [String]
     }
-    deriving (Generic, Show, Read, Eq, Typeable, Data)
+    deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)
 
 instance L.HasBuildInfo TestSuite where
     buildInfo f l = (\x -> l { testBuildInfo = x }) <$> f (testBuildInfo l)
diff --git a/src/Distribution/Types/TestSuiteInterface.hs b/src/Distribution/Types/TestSuiteInterface.hs
--- a/src/Distribution/Types/TestSuiteInterface.hs
+++ b/src/Distribution/Types/TestSuiteInterface.hs
@@ -21,8 +21,8 @@
 
      -- | Test interface \"exitcode-stdio-1.0\". The test-suite takes the form
      -- of an executable. It returns a zero exit code for success, non-zero for
-     -- failure. The stdout and stderr channels may be logged. It takes no
-     -- command line parameters and nothing on stdin.
+     -- failure. The stdout and stderr channels may be logged. Test tooling may
+     -- pass command line arguments and/or connect the stdin channel to the test.
      --
      TestSuiteExeV10 Version FilePath
 
@@ -35,7 +35,7 @@
      -- the given reason (e.g. unknown test type).
      --
    | TestSuiteUnsupported TestType
-   deriving (Eq, Generic, Read, Show, Typeable, Data)
+   deriving (Eq, Ord, Generic, Read, Show, Typeable, Data)
 
 instance Binary TestSuiteInterface
 instance Structured TestSuiteInterface
diff --git a/src/Distribution/Types/TestType.hs b/src/Distribution/Types/TestType.hs
--- a/src/Distribution/Types/TestType.hs
+++ b/src/Distribution/Types/TestType.hs
@@ -22,7 +22,7 @@
 data TestType = TestTypeExe Version     -- ^ \"type: exitcode-stdio-x.y\"
               | TestTypeLib Version     -- ^ \"type: detailed-x.y\"
               | TestTypeUnknown String Version -- ^ Some unknown test type e.g. \"type: foo\"
-    deriving (Generic, Show, Read, Eq, Typeable, Data)
+    deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)
 
 instance Binary TestType
 instance Structured TestType
diff --git a/src/Distribution/Types/VersionRange/Internal.hs b/src/Distribution/Types/VersionRange/Internal.hs
--- a/src/Distribution/Types/VersionRange/Internal.hs
+++ b/src/Distribution/Types/VersionRange/Internal.hs
@@ -56,7 +56,7 @@
   | MajorBoundVersion      Version -- @^>= ver@ (same as >= ver && < MAJ(ver)+1)
   | UnionVersionRanges     VersionRange VersionRange
   | IntersectVersionRanges VersionRange VersionRange
-  deriving ( Data, Eq, Generic, Read, Show, Typeable )
+  deriving ( Data, Eq, Ord, Generic, Read, Show, Typeable )
 
 instance Binary VersionRange
 instance Structured VersionRange
diff --git a/src/Distribution/Utils/Generic.hs b/src/Distribution/Utils/Generic.hs
--- a/src/Distribution/Utils/Generic.hs
+++ b/src/Distribution/Utils/Generic.hs
@@ -237,7 +237,7 @@
         Just (cn, bs') | cn .&. 0xC0 == 0x80 ->
             moreBytes (off + 1) (byteCount-1) overlong bs' ((acc `shiftL` 6) .|. fromIntegral cn .&. 0x3F)
         _ -> Just off
-        
+
 
 -- | Ignore a Unicode byte order mark (BOM) at the beginning of the input
 --
diff --git a/src/Distribution/Utils/ShortText.hs b/src/Distribution/Utils/ShortText.hs
--- a/src/Distribution/Utils/ShortText.hs
+++ b/src/Distribution/Utils/ShortText.hs
@@ -4,7 +4,7 @@
 
 -- | Compact representation of short 'Strings'
 --
--- This module is designed to be import qualifeid
+-- This module is designed to be import qualified
 --
 -- @
 -- import Distribution.Utils.ShortText (ShortText)
diff --git a/src/Distribution/Utils/Structured.hs b/src/Distribution/Utils/Structured.hs
--- a/src/Distribution/Utils/Structured.hs
+++ b/src/Distribution/Utils/Structured.hs
@@ -7,7 +7,6 @@
 {-# LANGUAGE TypeFamilies        #-}
 {-# LANGUAGE TypeOperators       #-}
 {-# LANGUAGE PatternSynonyms     #-}
-{-# LANGUAGE TypeInType          #-}
 -- |
 --
 -- Copyright: (c) 2019 Oleg Grenrus
@@ -321,7 +320,7 @@
 -- Generic
 -------------------------------------------------------------------------------
 
--- | Derive 'structure' genrically.
+-- | Derive 'structure' generically.
 genericStructure :: forall a. (Typeable a, Generic a, GStructured (Rep a)) => Proxy a -> Structure
 genericStructure _ = gstructured (typeRep (Proxy :: Proxy a)) (Proxy :: Proxy (Rep a)) 0
 
diff --git a/src/Language/Haskell/Extension.hs b/src/Language/Haskell/Extension.hs
--- a/src/Language/Haskell/Extension.hs
+++ b/src/Language/Haskell/Extension.hs
@@ -25,7 +25,6 @@
         knownExtensions
   ) where
 
-import qualified Prelude (head)
 import Distribution.Compat.Prelude
 
 import Data.Array (Array, accumArray, bounds, Ix(inRange), (!))
@@ -61,7 +60,7 @@
 
   -- | An unknown language, identified by its name.
   | UnknownLanguage String
-  deriving (Generic, Show, Read, Eq, Typeable, Data)
+  deriving (Generic, Show, Read, Eq, Ord, Typeable, Data)
 
 instance Binary Language
 instance Structured Language
@@ -121,28 +120,27 @@
 
 instance NFData Extension where rnf = genericRnf
 
+-- | Known Haskell language extensions, including deprecated and undocumented
+-- ones.
+--
+-- Check <https://downloads.haskell.org/~ghc/9.2.3/docs/html/users_guide/exts/table.html “Overview of all language extensions” in GHC User’s Guide>
+-- for more information.
 data KnownExtension =
 
   -- | Allow overlapping class instances, provided there is a unique
   -- most specific instance for each use.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XOverlappingInstances>
     OverlappingInstances
 
   -- | Ignore structural rules guaranteeing the termination of class
   -- instance resolution.  Termination is guaranteed by a fixed-depth
   -- recursion stack, and compilation may fail if this depth is
   -- exceeded.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XUndecidableInstances>
   | UndecidableInstances
 
   -- | Implies 'OverlappingInstances'.  Allow the implementation to
   -- choose an instance even when it is possible that further
   -- instantiation of types will lead to a more specific instance
   -- being applicable.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XIncoherentInstances>
   | IncoherentInstances
 
   -- | /(deprecated)/ Deprecated in favour of 'RecursiveDo'.
@@ -153,34 +151,29 @@
 
   -- | Allow recursive bindings in @do@ blocks, using the @rec@
   -- keyword, or @mdo@, a variant of @do@.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XRecursiveDo>
   | RecursiveDo
 
   -- | Provide syntax for writing list comprehensions which iterate
   -- over several lists together, like the 'zipWith' family of
   -- functions.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XParallelListComp>
   | ParallelListComp
 
   -- | Allow multiple parameters in a type class.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XMultiParamTypeClasses>
   | MultiParamTypeClasses
 
   -- | Enable the dreaded monomorphism restriction.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XNoMonomorphismRestriction>
   | MonomorphismRestriction
 
+  -- | Enable deep subsumption, relaxing the simple subsumption rules,
+  -- implicitly inserting eta-expansions when matching up function types
+  -- with different quantification structures.
+  | DeepSubsumption
+
   -- | Allow a specification attached to a multi-parameter type class
   -- which indicates that some parameters are entirely determined by
   -- others. The implementation will check that this property holds
   -- for the declared instances, and will use this property to reduce
   -- ambiguity in instance resolution.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XFunctionalDependencies>
   | FunctionalDependencies
 
   -- | /(deprecated)/ A synonym for 'RankNTypes'.
@@ -188,14 +181,10 @@
   -- Old description: Like 'RankNTypes' but does not allow a
   -- higher-rank type to itself appear on the left of a function
   -- arrow.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XRank2Types>
   | Rank2Types
 
   -- | Allow a universally-quantified type to occur on the left of a
   -- function arrow.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XRankNTypes>
   | RankNTypes
 
   -- | /(deprecated)/ A synonym for 'RankNTypes'.
@@ -203,197 +192,134 @@
   -- Old description: Allow data constructors to have polymorphic
   -- arguments.  Unlike 'RankNTypes', does not allow this for ordinary
   -- functions.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#arbitrary-rank-polymorphism>
   | PolymorphicComponents
 
   -- | Allow existentially-quantified data constructors.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XExistentialQuantification>
   | ExistentialQuantification
 
   -- | Cause a type variable in a signature, which has an explicit
   -- @forall@ quantifier, to scope over the definition of the
   -- accompanying value declaration.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XScopedTypeVariables>
   | ScopedTypeVariables
 
   -- | Deprecated, use 'ScopedTypeVariables' instead.
   | PatternSignatures
 
   -- | Enable implicit function parameters with dynamic scope.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XImplicitParams>
   | ImplicitParams
 
   -- | Relax some restrictions on the form of the context of a type
   -- signature.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XFlexibleContexts>
   | FlexibleContexts
 
   -- | Relax some restrictions on the form of the context of an
   -- instance declaration.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XFlexibleInstances>
   | FlexibleInstances
 
   -- | Allow data type declarations with no constructors.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XEmptyDataDecls>
   | EmptyDataDecls
 
   -- | Run the C preprocessor on Haskell source code.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#language-pragma>
   | CPP
 
   -- | Allow an explicit kind signature giving the kind of types over
   -- which a type variable ranges.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XKindSignatures>
   | KindSignatures
 
   -- | Enable a form of pattern which forces evaluation before an
   -- attempted match, and a form of strict @let@/@where@ binding.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XBangPatterns>
   | BangPatterns
 
   -- | Allow type synonyms in instance heads.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XTypeSynonymInstances>
   | TypeSynonymInstances
 
   -- | Enable Template Haskell, a system for compile-time
   -- metaprogramming.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XTemplateHaskell>
   | TemplateHaskell
 
   -- | Enable the Foreign Function Interface.  In GHC, implements the
   -- standard Haskell 98 Foreign Function Interface Addendum, plus
   -- some GHC-specific extensions.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#language-pragma>
   | ForeignFunctionInterface
 
   -- | Enable arrow notation.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XArrows>
   | Arrows
 
   -- | /(deprecated)/ Enable generic type classes, with default instances defined in
   -- terms of the algebraic structure of a type.
-  --
-  -- * <https://haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#generic-classes>
   | Generics
 
   -- | Enable the implicit importing of the module "Prelude".  When
   -- disabled, when desugaring certain built-in syntax into ordinary
   -- identifiers, use whatever is in scope rather than the "Prelude"
   -- -- version.
-  --
-  -- * <https://haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#rebindable-syntax-and-the-implicit-prelude-import>
   | ImplicitPrelude
 
   -- | Enable syntax for implicitly binding local names corresponding
   -- to the field names of a record.  Puns bind specific names, unlike
   -- 'RecordWildCards'.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XNamedFieldPuns>
   | NamedFieldPuns
 
   -- | Enable a form of guard which matches a pattern and binds
   -- variables.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XPatternGuards>
   | PatternGuards
 
   -- | Allow a type declared with @newtype@ to use @deriving@ for any
   -- class with an instance for the underlying type.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XGeneralizedNewtypeDeriving>
   | GeneralizedNewtypeDeriving
 
   -- Synonym for GeneralizedNewtypeDeriving added in GHC 8.6.1.
   | GeneralisedNewtypeDeriving
 
   -- | Enable the \"Trex\" extensible records system.
-  --
-  -- * <http://haskell.org/hugs/pages/users_guide/hugs-only.html#TREX>
   | ExtensibleRecords
 
   -- | Enable type synonyms which are transparent in some definitions
   -- and opaque elsewhere, as a way of implementing abstract
   -- datatypes.
-  --
-  -- * <http://haskell.org/hugs/pages/users_guide/restricted-synonyms.html>
   | RestrictedTypeSynonyms
 
   -- | Enable an alternate syntax for string literals,
   -- with string templating.
-  --
-  -- * <http://haskell.org/hugs/pages/users_guide/here-documents.html>
   | HereDocuments
 
   -- | Allow the character @#@ as a postfix modifier on identifiers.
   -- Also enables literal syntax for unboxed values.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XMagicHash>
   | MagicHash
 
   -- | Allow data types and type synonyms which are indexed by types,
   -- i.e. ad-hoc polymorphism for types.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XTypeFamilies>
   | TypeFamilies
 
   -- | Allow a standalone declaration which invokes the type class
   -- @deriving@ mechanism.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XStandaloneDeriving>
   | StandaloneDeriving
 
   -- | Allow certain Unicode characters to stand for certain ASCII
   -- character sequences, e.g. keywords and punctuation.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XUnicodeSyntax>
   | UnicodeSyntax
 
   -- | Allow the use of unboxed types as foreign types, e.g. in
   -- @foreign import@ and @foreign export@.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#language-options>
   | UnliftedFFITypes
 
   -- | Enable interruptible FFI.
-  --
-  -- * <https://haskell.org/ghc/docs/latest/html/users_guide/ffi-chap.html#interruptible-foreign-calls>
   | InterruptibleFFI
 
   -- | Allow use of CAPI FFI calling convention (@foreign import capi@).
-  --
-  -- * <https://haskell.org/ghc/docs/latest/html/users_guide/ffi-chap.html#the-capi-calling-convention>
   | CApiFFI
 
   -- | Defer validity checking of types until after expanding type
   -- synonyms, relaxing the constraints on how synonyms may be used.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XLiberalTypeSynonyms>
   | LiberalTypeSynonyms
 
   -- | Allow the name of a type constructor, type class, or type
   -- variable to be an infix operator.
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XTypeOperators>
   | TypeOperators
 
   -- | Enable syntax for implicitly binding local names corresponding
   -- to the field names of a record.  A wildcard binds all unmentioned
   -- names, unlike 'NamedFieldPuns'.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XRecordWildCards>
   | RecordWildCards
 
   -- | Deprecated, use 'NamedFieldPuns' instead.
@@ -401,131 +327,87 @@
 
   -- | Allow a record field name to be disambiguated by the type of
   -- the record it's in.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDisambiguateRecordFields>
   | DisambiguateRecordFields
 
   -- | Enable traditional record syntax (as supported by Haskell 98)
-  --
-  -- * <https://haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#traditional-record-syntax>
   | TraditionalRecordSyntax
 
   -- | Enable overloading of string literals using a type class, much
   -- like integer literals.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XOverloadedStrings>
   | OverloadedStrings
 
   -- | Enable generalized algebraic data types, in which type
   -- variables may be instantiated on a per-constructor basis. Implies
   -- 'GADTSyntax'.
-  --
-  -- * <https://haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#generalised-algebraic-data-types-gadts>
   | GADTs
 
   -- | Enable GADT syntax for declaring ordinary algebraic datatypes.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XGADTSyntax>
   | GADTSyntax
 
   -- | /(deprecated)/ Has no effect.
   --
   -- Old description: Make pattern bindings monomorphic.
-  --
-  -- * <https://downloads.haskell.org/~ghc/7.6.3/docs/html/users_guide/monomorphism.html>
   | MonoPatBinds
 
   -- | Relax the requirements on mutually-recursive polymorphic
   -- functions.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XRelaxedPolyRec>
   | RelaxedPolyRec
 
   -- | Allow default instantiation of polymorphic types in more
   -- situations.
-  --
-  -- * <http://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#type-defaulting-in-ghci>
   | ExtendedDefaultRules
 
   -- | Enable unboxed tuples.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XUnboxedTuples>
   | UnboxedTuples
 
   -- | Enable @deriving@ for classes 'Data.Typeable.Typeable' and
   -- 'Data.Generics.Data'.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDeriveDataTypeable>
   | DeriveDataTypeable
 
   -- | Enable @deriving@ for 'GHC.Generics.Generic' and 'GHC.Generics.Generic1'.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDeriveGeneric>
   | DeriveGeneric
 
   -- | Enable support for default signatures.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDefaultSignatures>
   | DefaultSignatures
 
   -- | Allow type signatures to be specified in instance declarations.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XInstanceSigs>
   | InstanceSigs
 
   -- | Allow a class method's type to place additional constraints on
   -- a class type variable.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XConstrainedClassMethods>
   | ConstrainedClassMethods
 
   -- | Allow imports to be qualified by the package name the module is
   -- intended to be imported from, e.g.
   --
   -- > import "network" Network.Socket
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XPackageImports>
   | PackageImports
 
   -- | /(deprecated)/ Allow a type variable to be instantiated at a
   -- polymorphic type.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XImpredicativeTypes>
   | ImpredicativeTypes
 
   -- | /(deprecated)/ Change the syntax for qualified infix operators.
-  --
-  -- * <http://www.haskell.org/ghc/docs/6.12.3/html/users_guide/syntax-extns.html#new-qualified-operators>
   | NewQualifiedOperators
 
   -- | Relax the interpretation of left operator sections to allow
   -- unary postfix operators.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XPostfixOperators>
   | PostfixOperators
 
   -- | Enable quasi-quotation, a mechanism for defining new concrete
   -- syntax for expressions and patterns.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XQuasiQuotes>
   | QuasiQuotes
 
   -- | Enable generalized list comprehensions, supporting operations
   -- such as sorting and grouping.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XTransformListComp>
   | TransformListComp
 
   -- | Enable monad comprehensions, which generalise the list
   -- comprehension syntax to work for any monad.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XMonadComprehensions>
   | MonadComprehensions
 
   -- | Enable view patterns, which match a value by applying a
   -- function and matching on the result.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XViewPatterns>
   | ViewPatterns
 
   -- | Allow concrete XML syntax to be used in expressions and patterns,
@@ -542,8 +424,6 @@
 
   -- | Enable the use of tuple sections, e.g. @(, True)@ desugars into
   -- @\x -> (x, True)@.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XTupleSections>
   | TupleSections
 
   -- | Allow GHC primops, written in C--, to be imported into a Haskell
@@ -552,8 +432,6 @@
 
   -- | Support for patterns of the form @n + k@, where @k@ is an
   -- integer literal.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XNPlusKPatterns>
   | NPlusKPatterns
 
   -- | Improve the layout rule when @if@ expressions are used in a @do@
@@ -561,56 +439,36 @@
   | DoAndIfThenElse
 
   -- | Enable support for multi-way @if@-expressions.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XMultiWayIf>
   | MultiWayIf
 
   -- | Enable support lambda-@case@ expressions.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XLambdaCase>
   | LambdaCase
 
   -- | Makes much of the Haskell sugar be desugared into calls to the
   -- function with a particular name that is in scope.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XRebindableSyntax>
   | RebindableSyntax
 
   -- | Make @forall@ a keyword in types, which can be used to give the
   -- generalisation explicitly.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XExplicitForAll>
   | ExplicitForAll
 
   -- | Allow contexts to be put on datatypes, e.g. the @Eq a@ in
   -- @data Eq a => Set a = NilSet | ConsSet a (Set a)@.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDatatypeContexts>
   | DatatypeContexts
 
   -- | Local (@let@ and @where@) bindings are monomorphic.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XMonoLocalBinds>
   | MonoLocalBinds
 
   -- | Enable @deriving@ for the 'Data.Functor.Functor' class.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDeriveFunctor>
   | DeriveFunctor
 
   -- | Enable @deriving@ for the 'Data.Traversable.Traversable' class.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDeriveTraversable>
   | DeriveTraversable
 
   -- | Enable @deriving@ for the 'Data.Foldable.Foldable' class.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDeriveFoldable>
   | DeriveFoldable
 
   -- | Enable non-decreasing indentation for @do@ blocks.
-  --
-  -- * <https://haskell.org/ghc/docs/latest/html/users_guide/bugs.html#context-free-syntax>
   | NondecreasingIndentation
 
   -- | Allow imports to be qualified with a safe keyword that requires
@@ -618,156 +476,107 @@
   -- definition of trust.
   --
   -- > import safe Network.Socket
-  --
-  -- * <https://haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#safe-imports>
   | SafeImports
 
   -- | Compile a module in the Safe, Safe Haskell mode -- a restricted
   -- form of the Haskell language to ensure type safety.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/safe_haskell.html#ghc-flag--XSafe>
   | Safe
 
   -- | Compile a module in the Trustworthy, Safe Haskell mode -- no
   -- restrictions apply but the module is marked as trusted as long as
   -- the package the module resides in is trusted.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/safe_haskell.html#ghc-flag--XTrustworthy>
   | Trustworthy
 
   -- | Compile a module in the Unsafe, Safe Haskell mode so that
   -- modules compiled using Safe, Safe Haskell mode can't import it.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/safe_haskell.html#ghc-flag--XUnsafe>
   | Unsafe
 
   -- | Allow type class/implicit parameter/equality constraints to be
   -- used as types with the special kind constraint.  Also generalise
   -- the @(ctxt => ty)@ syntax so that any type of kind constraint can
   -- occur before the arrow.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XConstraintKinds>
   | ConstraintKinds
 
   -- | Enable kind polymorphism.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XPolyKinds>
   | PolyKinds
 
   -- | Enable datatype promotion.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDataKinds>
   | DataKinds
 
+  -- | Enable @type data@ declarations, defining constructors at the type level.
+  | TypeData
+
   -- | Enable parallel arrays syntax (@[:@, @:]@) for /Data Parallel Haskell/.
-  --
-  -- * <http://www.haskell.org/haskellwiki/GHC/Data_Parallel_Haskell>
   | ParallelArrays
 
   -- | Enable explicit role annotations, like in (@type role Foo representational representational@).
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XRoleAnnotations>
   | RoleAnnotations
 
   -- | Enable overloading of list literals, arithmetic sequences and
   -- list patterns using the 'IsList' type class.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XOverloadedLists>
   | OverloadedLists
 
   -- | Enable case expressions that have no alternatives. Also applies to lambda-case expressions if they are enabled.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XEmptyCase>
   | EmptyCase
 
   -- | /(deprecated)/ Deprecated in favour of 'DeriveDataTypeable'.
   --
   -- Old description: Triggers the generation of derived 'Typeable'
   -- instances for every datatype and type class declaration.
-  --
-  -- * <https://haskell.org/ghc/docs/7.8.4/html/users_guide/deriving.html#auto-derive-typeable>
   | AutoDeriveTypeable
 
   -- | Desugars negative literals directly (without using negate).
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XNegativeLiterals>
   | NegativeLiterals
 
   -- | Allow the use of binary integer literal syntax (e.g. @0b11001001@ to denote @201@).
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XBinaryLiterals>
   | BinaryLiterals
 
   -- | Allow the use of floating literal syntax for all instances of 'Num', including 'Int' and 'Integer'.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XNumDecimals>
   | NumDecimals
 
   -- | Enable support for type classes with no type parameter.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XNullaryTypeClasses>
   | NullaryTypeClasses
 
   -- | Enable explicit namespaces in module import/export lists.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XExplicitNamespaces>
   | ExplicitNamespaces
 
   -- | Allow the user to write ambiguous types, and the type inference engine to infer them.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XAllowAmbiguousTypes>
   | AllowAmbiguousTypes
 
   -- | Enable @foreign import javascript@.
   | JavaScriptFFI
 
   -- | Allow giving names to and abstracting over patterns.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XPatternSynonyms>
   | PatternSynonyms
 
   -- | Allow anonymous placeholders (underscore) inside type signatures.  The
   -- type inference engine will generate a message describing the type inferred
   -- at the hole's location.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XPartialTypeSignatures>
   | PartialTypeSignatures
 
   -- | Allow named placeholders written with a leading underscore inside type
   -- signatures.  Wildcards with the same name unify to the same type.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XNamedWildCards>
   | NamedWildCards
 
   -- | Enable @deriving@ for any class.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDeriveAnyClass>
   | DeriveAnyClass
 
   -- | Enable @deriving@ for the 'Language.Haskell.TH.Syntax.Lift' class.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDeriveLift>
   | DeriveLift
 
   -- | Enable support for 'static pointers' (and the @static@
   -- keyword) to refer to globally stable names, even across
   -- different programs.
-  --
-  -- * <https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XStaticPointers>
   | StaticPointers
 
   -- | Switches data type declarations to be strict by default (as if
   -- they had a bang using @BangPatterns@), and allow opt-in field
   -- laziness using @~@.
-  --
-  -- * <https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#ghc-flag--XStrictData>
   | StrictData
 
   -- | Switches all pattern bindings to be strict by default (as if
   -- they had a bang using @BangPatterns@), ordinary patterns are
   -- recovered using @~@. Implies @StrictData@.
-  --
-  -- * <https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#ghc-flag--XStrict>
   | Strict
 
   -- | Allows @do@-notation for types that are @'Applicative'@ as well
@@ -830,8 +639,6 @@
   | StarIsType
 
   -- | Liberalises deriving to provide instances for empty data types.
-  --
-  -- * <https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#deriving-instances-for-empty-data-types>
   | EmptyDataDeriving
 
   -- | Enable detection of complete user-supplied kind signatures.
@@ -855,6 +662,9 @@
   -- | Enable linear types.
   | LinearTypes
 
+  -- | Allow the use of visible forall in types of terms.
+  | RequiredTypeArguments
+
   -- | Enable the generation of selector functions corresponding to record fields.
   | FieldSelectors
 
@@ -862,8 +672,6 @@
   | OverloadedRecordDot
 
   -- | Provides record @.@ syntax in record updates, e.g. @x {foo.bar = 1}@.
-  --
-  -- * <https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/exts/overloaded_record_update.html#extension-OverloadedRecordUpdate>
   | OverloadedRecordUpdate
 
   -- | Enable data types for which an unlifted or levity-polymorphic result kind is inferred.
@@ -943,9 +751,9 @@
 knownExtensionTable :: Array Char [(String, KnownExtension)]
 knownExtensionTable =
   accumArray (flip (:)) [] ('A', 'Z')
-    [ (Prelude.head str, (str, extension)) -- assume KnownExtension's Show returns a non-empty string
-    | extension <- [toEnum 0 ..]
-    , let str = show extension ]
+    [ (hd, (str, extension)) -- assume KnownExtension's Show returns a non-empty string
+    | (extension, str@(hd : _)) <- map (\e -> (e, show e)) [toEnum 0 ..]
+    ]
 
 knownExtensions :: [KnownExtension]
 knownExtensions = [minBound .. maxBound]
