Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mkDec function in src/Data/Array/Accelerate/Pattern/TH.hs to work with ghc version 9.8.1 #541

Closed
wants to merge 1 commit into from
Closed
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 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 @@
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite unfortunate that the Functor instance of TyVarBndr is only there since template-haskell 2.17.0.0, which means since GHC 9! Upping the lower bound to GHC 9 for this would indeed be a bit much :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested, but I suspect that everything should also work if you replace the () by a in the type signatures of mkDataD, mkNewtypeD, mkConP and mkConS in that file


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