Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
ghc: ["9.0", "9.2", "9.4", "9.6", "9.8", "9.10"]
ghc: ["9.0", "9.2", "9.4", "9.6", "9.8", "9.10", "9.12"]
env:
STACK_YAML: stack-${{ matrix.ghc }}.yaml
runs-on: ${{ matrix.os }}
Expand Down
14 changes: 7 additions & 7 deletions ghc-source-gen.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.36.0.
-- This file has been generated from package.yaml by hpack version 0.38.0.
--
-- see: https://github.com/sol/hpack

Expand Down Expand Up @@ -61,7 +61,7 @@ library
TypeSynonymInstances
build-depends:
base >=4.7 && <5
, ghc >=8.4 && <9.11
, ghc >=8.4 && <9.13
default-language: Haskell2010
if impl(ghc<8.10)
other-modules:
Expand Down Expand Up @@ -102,13 +102,13 @@ test-suite name_test
FlexibleInstances
TypeSynonymInstances
build-depends:
QuickCheck >=2.10 && <2.15
QuickCheck >=2.10 && <2.17
, base >=4.7 && <5
, ghc >=8.4 && <9.11
, ghc >=8.4 && <9.13
, ghc-source-gen
, tasty >=1.0 && <1.6
, tasty-hunit ==0.10.*
, tasty-quickcheck >=0.9 && <0.11
, tasty-quickcheck >=0.9 && <0.12
default-language: Haskell2010

test-suite pprint_examples
Expand All @@ -125,7 +125,7 @@ test-suite pprint_examples
TypeSynonymInstances
build-depends:
base >=4.7 && <5
, ghc >=8.4 && <9.11
, ghc >=8.4 && <9.13
, ghc-paths ==0.1.*
, ghc-source-gen
, tasty >=1.0 && <1.6
Expand All @@ -151,7 +151,7 @@ test-suite pprint_test
TypeSynonymInstances
build-depends:
base >=4.7 && <5
, ghc >=8.4 && <9.11
, ghc >=8.4 && <9.13
, ghc-paths ==0.1.*
, ghc-source-gen
, tasty >=1.0 && <1.6
Expand Down
6 changes: 3 additions & 3 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ description: |

dependencies:
- base >= 4.7 && < 5
- ghc >= 8.4 && < 9.11
- ghc >= 8.4 && < 9.13

default-extensions:
- DataKinds
Expand Down Expand Up @@ -116,7 +116,7 @@ tests:
source-dirs: tests
dependencies:
- ghc-source-gen
- QuickCheck >= 2.10 && < 2.15
- QuickCheck >= 2.10 && < 2.17
- tasty >= 1.0 && < 1.6
- tasty-hunit == 0.10.*
- tasty-quickcheck >= 0.9 && < 0.11
- tasty-quickcheck >= 0.9 && < 0.12
10 changes: 9 additions & 1 deletion src/GHC/SourceGen/Binds.hs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ typeSigs names t =
sigB $ TypeSig ann (map (typeRdrName . unqual) names)
$ sigWcType t
where
# if MIN_VERSION_ghc(9,12,0)
ann = AnnSig noAnn Nothing Nothing
# else
ann = AnnSig noAnn []
# endif
#else
sigB $ withEpAnnNotUsed TypeSig (map (typeRdrName . unqual) names)
$ sigWcType t
Expand Down Expand Up @@ -124,7 +128,11 @@ funBindsWithFixity fixity name matches = bindB $ withPlaceHolder
name' = valueRdrName $ unqual name
occ = valueOccName name
fixity' = fromMaybe (bool Prefix Infix $ isSymOcc occ) fixity
#if MIN_VERSION_ghc(9,12,0)
context = FunRhs name' fixity' NoSrcStrict noAnn
#else
context = FunRhs name' fixity' NoSrcStrict
#endif

-- | Defines a function or value.
--
Expand Down Expand Up @@ -328,7 +336,7 @@ stmt e =
-- > bvar "x" <-- var "act"
(<--) :: Pat' -> HsExpr' -> Stmt'
#if MIN_VERSION_ghc(9,10,0)
p <-- e = withPlaceHolder $ BindStmt [] (builtPat p) (mkLocated e)
p <-- e = withPlaceHolder $ BindStmt noAnn (builtPat p) (mkLocated e)
#elif MIN_VERSION_ghc(9,0,0)
p <-- e = withPlaceHolder $ withEpAnnNotUsed BindStmt (builtPat p) (mkLocated e)
#else
Expand Down
24 changes: 19 additions & 5 deletions src/GHC/SourceGen/Binds/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
-- https://developers.google.com/open-source/licenses/bsd

{-# LANGUAGE CPP #-}
{-# LANGUAGE TypeApplications #-}
module GHC.SourceGen.Binds.Internal where

#if MIN_VERSION_ghc(9,0,0)
Expand All @@ -17,6 +18,7 @@ import GHC.Types.Basic ( Origin(Generated)
#endif
)
import GHC.Data.Bag (listToBag)
import GHC.Hs.Extension (GhcPs)
#else
import BasicTypes (Origin(Generated))
import Bag (listToBag)
Expand All @@ -25,12 +27,16 @@ import GHC.Hs.Binds
import GHC.Hs.Decls
import GHC.Hs.Expr (MatchGroup(..), Match(..), GRHSs(..))

#if MIN_VERSION_ghc(9,12,0)
import Language.Haskell.Syntax.Extension (wrapXRec, noExtField)
#endif

#if !MIN_VERSION_ghc(8,6,0)
import PlaceHolder (PlaceHolder(..))
#endif

#if MIN_VERSION_ghc(9,10,0)
import GHC.Parser.Annotation (noAnn)
import GHC.Parser.Annotation (noAnn, emptyComments)
#endif

import GHC.SourceGen.Pat.Internal (parenthesize)
Expand All @@ -52,7 +58,11 @@ valBinds vbs =
#if MIN_VERSION_ghc(9,10,0)
HsValBinds noAnn
$ withNoAnnSortKey ValBinds
# if MIN_VERSION_ghc(9,12,0)
(map mkLocated binds)
# else
(listToBag $ map mkLocated binds)
# endif
(map mkLocated sigs)
#elif MIN_VERSION_ghc(8,6,0)
withEpAnnNotUsed HsValBinds
Expand Down Expand Up @@ -121,17 +131,22 @@ matchGroup context matches =
matches' = mkLocated $ map (mkLocated . mkMatch) matches
mkMatch :: RawMatch -> Match' LHsExpr'
#if MIN_VERSION_ghc(9,10,0)
mkMatch r = Match [] context
# if MIN_VERSION_ghc(9,12,0)
mkMatch r = Match noExtField context
(wrapXRec @GhcPs $ map builtPat $ map parenthesize $ rawMatchPats r)
# else
mkMatch r = Match noAnn context
(map builtPat $ map parenthesize $ rawMatchPats r)
(mkGRHSs $ rawMatchGRHSs r)
# endif
#else
mkMatch r = withEpAnnNotUsed Match context
(map builtPat $ map parenthesize $ rawMatchPats r)
(mkGRHSs $ rawMatchGRHSs r)
#endif
(mkGRHSs $ rawMatchGRHSs r)

mkGRHSs :: RawGRHSs -> GRHSs' LHsExpr'
mkGRHSs g = withEmptyEpAnnComments GRHSs
--mkGRHSs g = GRHSs emptyComments
#if MIN_VERSION_ghc(9,4,0)
(map mkLocated $ rawGRHSs g)
#else
Expand Down Expand Up @@ -166,7 +181,6 @@ type GuardedExpr = GRHS' LHsExpr'
class HasValBind t where
sigB :: Sig' -> t
bindB :: HsBind' -> t

instance HasValBind HsDecl' where
sigB = noExt SigD
bindB = noExt ValD
Expand Down
Loading