Skip to content

Commit

Permalink
Fix mkDec function in src/Data/Array/Accelerate/Pattern/TH.hs to work…
Browse files Browse the repository at this point in the history
… with ghc version 9.8.1

The template-haskell library version 2.21.0.0 has now made TyVarBndr types
contain other types. This patch removes an error during compilation caused
by mkDec passing the wrong kind of TyVarBndr to mkDataD and mkNewTypeD.
  • Loading branch information
noahmartinwilliams committed Feb 11, 2024
1 parent 334d055 commit e75e4e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion accelerate.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ flag nofib

library
build-depends:
base >= 4.12 && < 4.19
base >= 4.12 && < 4.20
, ansi-terminal >= 0.6.2
, base-orphans >= 0.3
, bytestring >= 0.10.2
Expand Down
11 changes: 9 additions & 2 deletions src/Data/Array/Accelerate/Pattern/TH.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,16 @@ mkPattern nm = do
mkDec :: Dec -> DecsQ
mkDec dec =
case dec of
DataD _ nm tv _ cs _ -> mkDataD nm tv cs
NewtypeD _ nm tv _ c _ -> mkNewtypeD nm tv c
DataD _ nm tv _ cs _ -> mkDataD nm (fixTVList tv) cs
NewtypeD _ nm tv _ c _ -> mkNewtypeD nm (fixTVList tv) c
_ -> fail "mkPatterns: expected the name of a newtype or datatype"

fixTV :: TyVarBndr a -> TyVarBndr ()
fixTV (PlainTV n _ ) = PlainTV n ()

Check failure on line 78 in src/Data/Array/Accelerate/Pattern/TH.hs

View workflow job for this annotation

GitHub Actions / cabal | ubuntu-latest-x64 ghc-8.10 release

• The constructor ‘PlainTV’ should have 1 argument, but has been given 2

Check failure on line 78 in src/Data/Array/Accelerate/Pattern/TH.hs

View workflow job for this annotation

GitHub Actions / cabal | ubuntu-latest-x64 ghc-8.10 debug

• The constructor ‘PlainTV’ should have 1 argument, but has been given 2

Check failure on line 78 in src/Data/Array/Accelerate/Pattern/TH.hs

View workflow job for this annotation

GitHub Actions / cabal | windows-latest-x64 ghc-8.10 release

• The constructor ‘PlainTV’ should have 1 argument, but has been given 2

Check failure on line 78 in src/Data/Array/Accelerate/Pattern/TH.hs

View workflow job for this annotation

GitHub Actions / cabal | macOS-latest-x64 ghc-8.10 release

• The constructor ‘PlainTV’ should have 1 argument, but has been given 2

Check failure on line 78 in src/Data/Array/Accelerate/Pattern/TH.hs

View workflow job for this annotation

GitHub Actions / cabal | macOS-latest-x64 ghc-8.10 debug

• The constructor ‘PlainTV’ should have 1 argument, but has been given 2
fixTV (KindedTV n _ k) = KindedTV n () k

fixTVList :: [TyVarBndr a] -> [TyVarBndr ()]
fixTVList list = map fixTV list

mkNewtypeD :: Name -> [TyVarBndr ()] -> Con -> DecsQ
mkNewtypeD tn tvs c = mkDataD tn tvs [c]
Expand Down

0 comments on commit e75e4e1

Please sign in to comment.