Skip to content

Commit

Permalink
Merge pull request haskell#9580 from cabalism/grammar/known-languages
Browse files Browse the repository at this point in the history
Use knownLanguages for describing Language
  • Loading branch information
mergify[bot] committed Jan 4, 2024
2 parents 12223d7 + 6a7656e commit 4e51eb7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions Cabal-described/src/Distribution/Described.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ module Distribution.Described (
) where

import Prelude
(Bool (..), Char, Either (..), Enum (..), Eq (..), Ord (..), Show (..), String, elem, fmap, foldr, id, map, maybe, otherwise, return, undefined, ($),
(.))
( Bool (..), Char, Either (..), Enum (..), Eq (..), Ord (..), Show (..), String
, elem, fmap, foldr, id, map, maybe, otherwise, return, reverse, undefined
, ($), (.), (<$>)
)

import Data.Functor.Identity (Identity (..))
import Data.Maybe (fromMaybe)
Expand Down Expand Up @@ -100,7 +102,7 @@ import Distribution.Types.UnqualComponentName (UnqualComponentName)
import Distribution.Utils.Path (LicenseFile, PackageDir, SourceDir, SymbolicPath)
import Distribution.Verbosity (Verbosity)
import Distribution.Version (Version, VersionRange)
import Language.Haskell.Extension (Extension, Language)
import Language.Haskell.Extension (Extension, Language, knownLanguages)

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

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

instance Described LegacyExeDependency where
describe _ = RETodo
Expand Down
2 changes: 1 addition & 1 deletion Cabal-syntax/src/Language/Haskell/Extension.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ instance Structured Language

instance NFData Language where rnf = genericRnf

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

Expand Down

0 comments on commit 4e51eb7

Please sign in to comment.