@@ -14,6 +14,9 @@ import Control.Monad (join, replicateM, unless)
1414import Data.List (foldl' )
1515import Data.Maybe (fromMaybe )
1616import Data.Proxy
17+
18+ -- importing in this order to avoid unused import warning
19+ import Language.Haskell.TH.Datatype.TyVarBndr
1720import Language.Haskell.TH
1821import Language.Haskell.TH.Datatype as TH
1922
@@ -186,22 +189,22 @@ deriveMetadataType n datatypeInfoName = do
186189 [ tySynD datatypeInfoName' [] (metadataType' variant name cons) ]
187190
188191deriveGenericForDataDec ::
189- (Name -> Q Type ) -> DatatypeVariant -> Cxt -> Name -> [TyVarBndr ] -> [Type ] -> [TH. ConstructorInfo ] -> Q [Dec ]
192+ (Name -> Q Type ) -> DatatypeVariant -> Cxt -> Name -> [TyVarBndrUnit ] -> [Type ] -> [TH. ConstructorInfo ] -> Q [Dec ]
190193deriveGenericForDataDec f _variant _cxt name _bndrs instTys cons = do
191194 let typ = appTysSubst f name instTys
192195 deriveGenericForDataType f typ cons
193196
194197deriveGenericForDataType :: (Name -> Q Type ) -> Q Type -> [TH. ConstructorInfo ] -> Q [Dec ]
195198deriveGenericForDataType f typ cons = do
196- let codeSyn = tySynInstDCompat ''Code Nothing [typ] (codeFor f cons)
199+ let codeSyn = tySynInstDCompat ''Generics . SOP.Universe. Code Nothing [typ] (codeFor f cons)
197200 inst <- instanceD
198201 (cxt [] )
199202 [t | Generic $typ |]
200203 [codeSyn, embedding 'from cons, projection 'to cons]
201204 return [inst]
202205
203206deriveMetadataForDataDec ::
204- (Name -> Q Type ) -> DatatypeVariant -> Cxt -> Name -> [TyVarBndr ] -> [Type ] -> [TH. ConstructorInfo ] -> Q [Dec ]
207+ (Name -> Q Type ) -> DatatypeVariant -> Cxt -> Name -> [TyVarBndrUnit ] -> [Type ] -> [TH. ConstructorInfo ] -> Q [Dec ]
205208deriveMetadataForDataDec f variant _cxt name _bndrs instTys cons = do
206209 let typ = appTysSubst f name instTys
207210 deriveMetadataForDataType variant name typ cons
@@ -508,7 +511,7 @@ promotedTypeListSubst f (t:ts) = [t| $promotedConsT $(t >>= substType f) $(promo
508511appsT :: Name -> [Q Type ] -> Q Type
509512appsT n = foldl' appT (conT n)
510513
511- appTyVars :: (Name -> Q Type ) -> Name -> [TyVarBndr ] -> Q Type
514+ appTyVars :: (Name -> Q Type ) -> Name -> [TyVarBndrUnit ] -> Q Type
512515appTyVars f n bndrs =
513516 appsT n (map (f . tvName) bndrs)
514517
@@ -545,7 +548,7 @@ withDataDec :: TH.DatatypeInfo
545548 -- The datatype context
546549 -> Name
547550 -- The data type's name
548- -> [TyVarBndr ]
551+ -> [TyVarBndrUnit ]
549552 -- The datatype's type variable binders, both implicit and explicit.
550553 -- Examples:
551554 --
0 commit comments