GHC 9.2.2 support
Hello,
There are currently build errors when attempting to build with GHC 9.2.2:
Resolving dependencies...
Build profile: -w ghc-9.2.2 -O1
In order, the following will be built (use -v for more details):
- cql-4.0.3 (lib) (first run)
Configuring library for cql-4.0.3..
Preprocessing library for cql-4.0.3..
Building library for cql-4.0.3..
[ 1 of 11] Compiling Database.CQL.Protocol.Tuple.TH ( src/Database/CQL/Protocol/Tuple/TH.hs, /home/kamek/Dev/cql/dist-newstyle/build/x86_64-linux/ghc-9.2.2/cql-4.0.3/build/Database/CQL/Protocol/Tuple/TH.o, /home/kamek/Dev/cql/dist-newstyle/build/x86_64-linux/ghc-9.2.2/cql-4.0.3/build/Database/CQL/Protocol/Tuple/TH.dyn_o )
src/Database/CQL/Protocol/Tuple/TH.hs:73:64: error:
• Couldn't match expected type ‘Exp’
with actual type ‘[Stmt] -> Exp’
• In the second argument of ‘($)’, namely ‘body v names’
In the second argument of ‘Clause’, namely
‘(NormalB $ body v names)’
In the second argument of ‘($)’, namely
‘Clause
[VarP v, TupP (map VarP names)] (NormalB $ body v names) []’
|
73 | return $ Clause [VarP v, TupP (map VarP names)] (NormalB $ body v names) []
| ^^^^^^^^^^^^
src/Database/CQL/Protocol/Tuple/TH.hs:75:25: error:
• Couldn't match expected type: Maybe
Language.Haskell.TH.Syntax.ModName
with actual type: [Stmt]
• In the first argument of ‘DoE’, namely
‘(NoBindS size : map (NoBindS . value x) names)’
In the expression:
DoE (NoBindS size : map (NoBindS . value x) names)
In an equation for ‘body’:
body x names = DoE (NoBindS size : map (NoBindS . value x) names)
|
75 | body x names = DoE (NoBindS size : map (NoBindS . value x) names)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/Database/CQL/Protocol/Tuple/TH.hs:120:35: error:
• Couldn't match expected type ‘Pat’
with actual type ‘[Pat] -> Pat’
• Probable cause: ‘ConP’ is applied to too few arguments
In the first argument of ‘ParensP’, namely
‘(ConP (mkName "CqlTuple") [ListP (map VarP names)])’
In the first argument of ‘Match’, namely
‘(ParensP (ConP (mkName "CqlTuple") [ListP (map VarP names)]))’
In the expression:
Match
(ParensP (ConP (mkName "CqlTuple") [ListP (map VarP names)]))
(NormalB $ body names) []
|
120 | [ Match (ParensP (ConP (mkName "CqlTuple") [ListP (map VarP names)]))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/Database/CQL/Protocol/Tuple/TH.hs:120:61: error:
• Couldn't match expected type ‘Type’ with actual type ‘Pat’
• In the expression: ListP (map VarP names)
In the second argument of ‘ConP’, namely ‘[ListP (map VarP names)]’
In the first argument of ‘ParensP’, namely
‘(ConP (mkName "CqlTuple") [ListP (map VarP names)])’
|
120 | [ Match (ParensP (ConP (mkName "CqlTuple") [ListP (map VarP names)]))
| ^^^^^^^^^^^^^^^^^^^^^^
All these appear to be Template Haskell related. I'm not much of a TH expert, but Serokell has a nice article on porting TH code in a way that's backward compatible with GHC 8: https://serokell.io/blog/typed-template-haskell-in-ghc-9
If none of the maintainers have some time to put into this, I'd be happy to give it a try myself.