Skip to content

Commit 4e51eb7

Browse files
authored
Merge pull request #9580 from cabalism/grammar/known-languages
Use knownLanguages for describing Language
2 parents 12223d7 + 6a7656e commit 4e51eb7

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

Cabal-described/src/Distribution/Described.hs

+6-4
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ module Distribution.Described (
3939
) where
4040

4141
import Prelude
42-
(Bool (..), Char, Either (..), Enum (..), Eq (..), Ord (..), Show (..), String, elem, fmap, foldr, id, map, maybe, otherwise, return, undefined, ($),
43-
(.))
42+
( Bool (..), Char, Either (..), Enum (..), Eq (..), Ord (..), Show (..), String
43+
, elem, fmap, foldr, id, map, maybe, otherwise, return, reverse, undefined
44+
, ($), (.), (<$>)
45+
)
4446

4547
import Data.Functor.Identity (Identity (..))
4648
import Data.Maybe (fromMaybe)
@@ -100,7 +102,7 @@ import Distribution.Types.UnqualComponentName (UnqualComponentName)
100102
import Distribution.Utils.Path (LicenseFile, PackageDir, SourceDir, SymbolicPath)
101103
import Distribution.Verbosity (Verbosity)
102104
import Distribution.Version (Version, VersionRange)
103-
import Language.Haskell.Extension (Extension, Language)
105+
import Language.Haskell.Extension (Extension, Language, knownLanguages)
104106

105107
-- | Class describing the pretty/parsec format of a.
106108
class (Pretty a, Parsec a) => Described a where
@@ -422,7 +424,7 @@ instance Described IncludeRenaming where
422424
mr = describe (Proxy :: Proxy ModuleRenaming)
423425

424426
instance Described Language where
425-
describe _ = REUnion ["GHC2021", "Haskell2010", "Haskell98"]
427+
describe _ = REUnion $ (REString . show) <$> reverse knownLanguages
426428

427429
instance Described LegacyExeDependency where
428430
describe _ = RETodo

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ instance Structured Language
6363

6464
instance NFData Language where rnf = genericRnf
6565

66-
-- | List of known (supported) languages for GHC
66+
-- | List of known (supported) languages for GHC, oldest first.
6767
knownLanguages :: [Language]
6868
knownLanguages = [Haskell98, Haskell2010, GHC2021]
6969

0 commit comments

Comments
 (0)