Skip to content

Commit

Permalink
[#83] Support GHC-9.4 (#84)
Browse files Browse the repository at this point in the history
* [#83] Support GHC-9.4

Resolves #83

* Add release date
  • Loading branch information
vrom911 authored Oct 14, 2022
1 parent 8a7c6ab commit 188b1b6
Show file tree
Hide file tree
Showing 9 changed files with 207 additions and 161 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @chshersh @vrom911
* @vrom911
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
cabal: ["3.4"]
cabal: ["3.8"]
ghc:
- "8.8.4"
- "8.10.7"
- "9.0.2"
- "9.2.4"
- "9.4.2"

steps:
- uses: actions/checkout@v3
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@
`extensions` uses [PVP Versioning][1].
The changelog is available [on GitHub][2].

## Unreleased

## 0.1.0.0 — Oct 14, 2022

* [#74](https://github.com/kowainik/extensions/issues/74):
Support GHC-9.2.
* [#83](https://github.com/kowainik/extensions/issues/83):
Support GHC-9.4.
* Support `Cabal` `3.4`, `3.6` and `3.8`.
* [#70](https://github.com/kowainik/extensions/issues/70):
Parse empty lines and spaces in before comments and pragmas in the beginning
of the file.
Expand Down
27 changes: 17 additions & 10 deletions extensions.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: extensions
version: 0.0.0.1
version: 0.1.0.0
synopsis: Parse Haskell Language Extensions
description: Parse Haskell Language Extensions.
See [README.md](https://github.com/kowainik/extensions#extensions) for more details.
Expand All @@ -10,14 +10,16 @@ license: MPL-2.0
license-file: LICENSE
author: Veronika Romashkina, Dmitrii Kovanikov
maintainer: Kowainik <[email protected]>
copyright: 2020 Kowainik
copyright: 2020-2022 Kowainik
category: GHC, Parsing, Haskell
build-type: Simple
extra-doc-files: README.md
CHANGELOG.md
tested-with: GHC == 8.8.4
GHC == 8.10.7
GHC == 9.0.2
GHC == 9.2.4
GHC == 9.4.2

flag executable
description: Build the extensions executable
Expand All @@ -29,7 +31,7 @@ source-repository head
location: https://github.com/kowainik/extensions.git

common common-options
build-depends: base >= 4.13.0.0 && < 4.16
build-depends: base >= 4.13.0.0 && < 4.18

ghc-options: -Wall
-Wcompat
Expand All @@ -47,6 +49,11 @@ common common-options
ghc-options: -Wmissing-deriving-strategies
if impl(ghc >= 8.10.1)
ghc-options: -Wunused-packages
if impl(ghc >= 9.0)
ghc-options: -Winvalid-haddock
if impl(ghc >= 9.2)
ghc-options: -Woperator-whitespace
-Wredundant-bang-patterns

default-language: Haskell2010
default-extensions: ConstraintKinds
Expand All @@ -73,14 +80,14 @@ library
Extensions.Package
Extensions.Types

build-depends: bytestring ^>= 0.10
, Cabal >= 3.0 && < 3.5
build-depends: bytestring >= 0.10 && < 0.12
, Cabal >= 3.0 && < 3.9
, containers ^>= 0.6
, directory ^>= 1.3
, filepath ^>= 1.4
, ghc-boot-th >= 8.8.1 && < 9.1
, ghc-boot-th >= 8.8.1 && < 9.5
, parsec ^>= 3.1
, text ^>= 1.2.3
, text >= 1.2.3 && < 2.1

executable extensions
import: common-options
Expand All @@ -95,7 +102,7 @@ executable extensions
, containers
, directory
, filepath
, optparse-applicative >= 0.15 && < 0.17
, optparse-applicative >= 0.15 && < 0.18
, text

test-suite extensions-test
Expand All @@ -111,10 +118,10 @@ test-suite extensions-test
, bytestring
, containers
, ghc-boot-th
, hedgehog ^>= 1.0
, hedgehog >= 1.0 && < 1.3
, hspec
, hspec-hedgehog ^>= 0.0.1
, text ^>= 1.2
, text
ghc-options: -threaded
-rtsopts
-with-rtsopts=-N
2 changes: 1 addition & 1 deletion src/Extensions.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{- |
Copyright: (c) 2020 Kowainik
Copyright: (c) 2020-2022 Kowainik
SPDX-License-Identifier: MPL-2.0
Maintainer: Kowainik <[email protected]>
Expand Down
301 changes: 164 additions & 137 deletions src/Extensions/Cabal.hs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Extensions/Module.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{- |
Copyright: (c) 2020 Kowainik
Copyright: (c) 2020-2022 Kowainik
SPDX-License-Identifier: MPL-2.0
Maintainer: Kowainik <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion src/Extensions/Package.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{- |
Copyright: (c) 2020 Kowainik
Copyright: (c) 2020-2022 Kowainik
SPDX-License-Identifier: MPL-2.0
Maintainer: Kowainik <[email protected]>
Expand Down
20 changes: 12 additions & 8 deletions src/Extensions/Types.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{-# OPTIONS_GHC -fno-warn-orphans #-}

{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE CPP #-}

{- |
Copyright: (c) 2020 Kowainik
Copyright: (c) 2020-2022 Kowainik
SPDX-License-Identifier: MPL-2.0
Maintainer: Kowainik <[email protected]>
Expand Down Expand Up @@ -173,7 +173,9 @@ showOnOffExtension = \case
showExtension :: Extension -> Text
showExtension = \case
Cpp -> "CPP"
#if !MIN_VERSION_ghc_boot_th(9,4,1)
RecordPuns -> "NamedFieldPuns"
#endif
ext -> Text.pack $ show ext

{- | Parse 'OnOffExtension' from a string that specifies extension.
Expand All @@ -193,12 +195,14 @@ doesn't always work since some extensions are named differently.
readExtension :: String -> Maybe Extension
readExtension = \case
"GeneralisedNewtypeDeriving" -> Just GeneralizedNewtypeDeriving
"NamedFieldPuns" -> Just RecordPuns
"RecordPuns" -> Nothing
"Rank2Types" -> Just RankNTypes
"CPP" -> Just Cpp
"Cpp" -> Nothing
s -> readMaybe s
#if !MIN_VERSION_ghc_boot_th(9,4,1)
"NamedFieldPuns" -> Just RecordPuns
"RecordPuns" -> Nothing
#endif
"Rank2Types" -> Just RankNTypes
"CPP" -> Just Cpp
"Cpp" -> Nothing
s -> readMaybe s

{- | Take accumulated 'OnOffExtension's, and merge them into one 'Set',
excluding enabling of 'default2010Extensions'.
Expand Down

0 comments on commit 188b1b6

Please sign in to comment.