th-data-compat 0.1.1.0 → 0.1.1.1
raw patch · 7 files changed
+84/−79 lines, 7 filesdep ~template-haskellPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: template-haskell
API changes (from Hackage documentation)
- Language.Haskell.TH.Compat.Data: dataD' :: CxtQ -> Name -> [TyVarBndr] -> [ConQ] -> [Name] -> DecQ
+ Language.Haskell.TH.Compat.Data: dataD' :: CxtQ -> Name -> [TyVarBndr ()] -> [ConQ] -> [Name] -> DecQ
- Language.Haskell.TH.Compat.Data: newtypeD' :: CxtQ -> Name -> [TyVarBndr] -> ConQ -> [Name] -> DecQ
+ Language.Haskell.TH.Compat.Data: newtypeD' :: CxtQ -> Name -> [TyVarBndr ()] -> ConQ -> [Name] -> DecQ
- Language.Haskell.TH.Compat.Data: unDataD :: Dec -> Maybe (Cxt, Name, [TyVarBndr], Maybe Kind, [Con], [Type])
+ Language.Haskell.TH.Compat.Data: unDataD :: Dec -> Maybe (Cxt, Name, [TyVarBndr ()], Maybe Kind, [Con], [Type])
- Language.Haskell.TH.Compat.Data: unDataInstD :: Dec -> Maybe (Cxt, Maybe [TyVarBndr], Type, Maybe Kind, [Con], [Type])
+ Language.Haskell.TH.Compat.Data: unDataInstD :: Dec -> Maybe (Cxt, Maybe [TyVarBndr ()], Type, Maybe Kind, [Con], [Type])
- Language.Haskell.TH.Compat.Data: unNewtypeD :: Dec -> Maybe (Cxt, Name, [TyVarBndr], Maybe Kind, Con, [Type])
+ Language.Haskell.TH.Compat.Data: unNewtypeD :: Dec -> Maybe (Cxt, Name, [TyVarBndr ()], Maybe Kind, Con, [Type])
- Language.Haskell.TH.Compat.Data: unNewtypeInstD :: Dec -> Maybe (Cxt, Maybe [TyVarBndr], Type, Maybe Kind, Con, [Type])
+ Language.Haskell.TH.Compat.Data: unNewtypeInstD :: Dec -> Maybe (Cxt, Maybe [TyVarBndr ()], Type, Maybe Kind, Con, [Type])
Files
- src/Language/Haskell/TH/Compat/Data.hs +1/−1
- src/Language/Haskell/TH/Compat/Data/V210.hs +1/−0
- src/Language/Haskell/TH/Compat/Data/V211.hs +1/−0
- src/Language/Haskell/TH/Compat/Data/V214.hs +1/−0
- src/Language/Haskell/TH/Compat/Data/V215.hs +0/−71
- src/Language/Haskell/TH/Compat/Data/V216.hs +72/−0
- th-data-compat.cabal +8/−7
src/Language/Haskell/TH/Compat/Data.hs view
@@ -22,7 +22,7 @@ #if MIN_VERSION_template_haskell(2,17,0) import Language.Haskell.TH.Compat.Data.Current #elif MIN_VERSION_template_haskell(2,15,0)-import Language.Haskell.TH.Compat.Data.V215+import Language.Haskell.TH.Compat.Data.V216 #elif MIN_VERSION_template_haskell(2,12,0) import Language.Haskell.TH.Compat.Data.V214 #elif MIN_VERSION_template_haskell(2,11,0)
src/Language/Haskell/TH/Compat/Data/V210.hs view
@@ -1,3 +1,4 @@+-- The latest version of applying this module impl is template-haskell-2.10 module Language.Haskell.TH.Compat.Data.V210 ( dataD', unDataD, newtypeD', unNewtypeD,
src/Language/Haskell/TH/Compat/Data/V211.hs view
@@ -1,3 +1,4 @@+-- The latest version of applying this module impl is template-haskell-2.11 module Language.Haskell.TH.Compat.Data.V211 ( dataD', unDataD, newtypeD', unNewtypeD,
src/Language/Haskell/TH/Compat/Data/V214.hs view
@@ -1,3 +1,4 @@+-- The latest version of applying this module impl is template-haskell-2.14 module Language.Haskell.TH.Compat.Data.V214 ( dataD', unDataD, newtypeD', unNewtypeD,
− src/Language/Haskell/TH/Compat/Data/V215.hs
@@ -1,71 +0,0 @@-module Language.Haskell.TH.Compat.Data.V215 (- dataD', unDataD,- newtypeD', unNewtypeD,- dataInstD', unDataInstD,- newtypeInstD', unNewtypeInstD,- unInstanceD,- ) where--import Language.Haskell.TH- (CxtQ, ConQ, TypeQ, DecQ,- Cxt, Con, Type, Name, TyVarBndr, Kind,- Dec (DataD, NewtypeD, DataInstD, NewtypeInstD, InstanceD),- DerivClauseQ, DerivClause (..), Pred,- dataD, newtypeD, dataInstD, newtypeInstD, derivClause, conT)---derivesFromNames :: [Name] -> [DerivClauseQ]-derivesFromNames ns = [derivClause Nothing $ map conT ns]--unDerivClause :: DerivClause -> [Pred]-unDerivClause (DerivClause _ ps) = ps---- | Definition against 'dataD',--- compatible with before temaplate-haskell-2.11-dataD' :: CxtQ -> Name -> [TyVarBndr] -> [ConQ] -> [Name]- -> DecQ-dataD' cxt n bs cs ds = dataD cxt n bs Nothing cs $ derivesFromNames ds---- | Compatible interface to destruct 'DataD'-unDataD :: Dec -> Maybe (Cxt, Name, [TyVarBndr], Maybe Kind, [Con], [Type])-unDataD (DataD cxt n bs mk cs ds) = Just (cxt, n, bs, mk, cs, ds >>= unDerivClause)-unDataD _ = Nothing---- | Definition against 'newtypeD',--- compatible with before temaplate-haskell-2.11-newtypeD' :: CxtQ -> Name -> [TyVarBndr] -> ConQ -> [Name]- -> DecQ-newtypeD' cxt n bs c ds = newtypeD cxt n bs Nothing c $ derivesFromNames ds---- | Compatible interface to destruct 'NewtypeD'-unNewtypeD :: Dec -> Maybe (Cxt, Name, [TyVarBndr], Maybe Kind, Con, [Type])-unNewtypeD (NewtypeD cxt n bs mk c ds) = Just (cxt, n, bs, mk, c, ds >>= unDerivClause)-unNewtypeD _ = Nothing---- | Definition against 'dataInstD',--- compatible with before temaplate-haskell-2.11-dataInstD' :: CxtQ -> Name -> [TypeQ] -> [ConQ] -> [Name]- -> DecQ-dataInstD' cxt n as cs ds = dataInstD cxt n as Nothing cs $ derivesFromNames ds---- | Compatible interface to destruct 'DataInstD'-unDataInstD :: Dec -> Maybe (Cxt, Maybe [TyVarBndr], Type, Maybe Kind, [Con], [Type])-unDataInstD (DataInstD cxt b ty mk cs ds) = Just (cxt, b, ty, mk, cs, ds >>= unDerivClause)-unDataInstD _ = Nothing---- | Definition against 'newtypeInstD',--- compatible with before temaplate-haskell-2.11-newtypeInstD' :: CxtQ -> Name -> [TypeQ] -> ConQ -> [Name]- -> DecQ-newtypeInstD' cxt n as c ds = newtypeInstD cxt n as Nothing c $ derivesFromNames ds---- | Compatible interface to destruct 'NewtypeInstD'-unNewtypeInstD :: Dec -> Maybe (Cxt, Maybe [TyVarBndr], Type, Maybe Kind, Con, [Type])-unNewtypeInstD (NewtypeInstD cxt b ty mk c ds) = Just (cxt, b, ty, mk, c, ds >>= unDerivClause)-unNewtypeInstD _ = Nothing---- | Compatible interface to destruct 'InstanceD'--- No Overlap type is defined before template-haskell-2.11.-unInstanceD :: Dec -> Maybe (Cxt, Type, [Dec])-unInstanceD (InstanceD _ cxt ty decs) = Just (cxt, ty, decs)-unInstanceD _ = Nothing
+ src/Language/Haskell/TH/Compat/Data/V216.hs view
@@ -0,0 +1,72 @@+-- The latest version of applying this module impl is template-haskell-2.16+module Language.Haskell.TH.Compat.Data.V216 (+ dataD', unDataD,+ newtypeD', unNewtypeD,+ dataInstD', unDataInstD,+ newtypeInstD', unNewtypeInstD,+ unInstanceD,+ ) where++import Language.Haskell.TH+ (CxtQ, ConQ, TypeQ, DecQ,+ Cxt, Con, Type, Name, TyVarBndr, Kind,+ Dec (DataD, NewtypeD, DataInstD, NewtypeInstD, InstanceD),+ DerivClauseQ, DerivClause (..), Pred,+ dataD, newtypeD, dataInstD, newtypeInstD, derivClause, conT)+++derivesFromNames :: [Name] -> [DerivClauseQ]+derivesFromNames ns = [derivClause Nothing $ map conT ns]++unDerivClause :: DerivClause -> [Pred]+unDerivClause (DerivClause _ ps) = ps++-- | Definition against 'dataD',+-- compatible with before temaplate-haskell-2.11+dataD' :: CxtQ -> Name -> [TyVarBndr] -> [ConQ] -> [Name]+ -> DecQ+dataD' cxt n bs cs ds = dataD cxt n bs Nothing cs $ derivesFromNames ds++-- | Compatible interface to destruct 'DataD'+unDataD :: Dec -> Maybe (Cxt, Name, [TyVarBndr], Maybe Kind, [Con], [Type])+unDataD (DataD cxt n bs mk cs ds) = Just (cxt, n, bs, mk, cs, ds >>= unDerivClause)+unDataD _ = Nothing++-- | Definition against 'newtypeD',+-- compatible with before temaplate-haskell-2.11+newtypeD' :: CxtQ -> Name -> [TyVarBndr] -> ConQ -> [Name]+ -> DecQ+newtypeD' cxt n bs c ds = newtypeD cxt n bs Nothing c $ derivesFromNames ds++-- | Compatible interface to destruct 'NewtypeD'+unNewtypeD :: Dec -> Maybe (Cxt, Name, [TyVarBndr], Maybe Kind, Con, [Type])+unNewtypeD (NewtypeD cxt n bs mk c ds) = Just (cxt, n, bs, mk, c, ds >>= unDerivClause)+unNewtypeD _ = Nothing++-- | Definition against 'dataInstD',+-- compatible with before temaplate-haskell-2.11+dataInstD' :: CxtQ -> Name -> [TypeQ] -> [ConQ] -> [Name]+ -> DecQ+dataInstD' cxt n as cs ds = dataInstD cxt n as Nothing cs $ derivesFromNames ds++-- | Compatible interface to destruct 'DataInstD'+unDataInstD :: Dec -> Maybe (Cxt, Maybe [TyVarBndr], Type, Maybe Kind, [Con], [Type])+unDataInstD (DataInstD cxt b ty mk cs ds) = Just (cxt, b, ty, mk, cs, ds >>= unDerivClause)+unDataInstD _ = Nothing++-- | Definition against 'newtypeInstD',+-- compatible with before temaplate-haskell-2.11+newtypeInstD' :: CxtQ -> Name -> [TypeQ] -> ConQ -> [Name]+ -> DecQ+newtypeInstD' cxt n as c ds = newtypeInstD cxt n as Nothing c $ derivesFromNames ds++-- | Compatible interface to destruct 'NewtypeInstD'+unNewtypeInstD :: Dec -> Maybe (Cxt, Maybe [TyVarBndr], Type, Maybe Kind, Con, [Type])+unNewtypeInstD (NewtypeInstD cxt b ty mk c ds) = Just (cxt, b, ty, mk, c, ds >>= unDerivClause)+unNewtypeInstD _ = Nothing++-- | Compatible interface to destruct 'InstanceD'+-- No Overlap type is defined before template-haskell-2.11.+unInstanceD :: Dec -> Maybe (Cxt, Type, [Dec])+unInstanceD (InstanceD _ cxt ty decs) = Just (cxt, ty, decs)+unInstanceD _ = Nothing
th-data-compat.cabal view
@@ -1,6 +1,6 @@ name: th-data-compat-version: 0.1.1.0+version: 0.1.1.1 synopsis: Compatibility for data definition template of TH description: This package contains wrapped name definitions of data definition template@@ -8,11 +8,12 @@ license-file: LICENSE author: Kei Hibino maintainer: ex8k.hibino@gmail.com-copyright: Copyright (c) 2016-2020 Kei Hibino+copyright: Copyright (c) 2016-2023 Kei Hibino category: Language build-type: Simple cabal-version: >=1.10-tested-with: GHC == 9.2.1, GHC == 9.2.2+tested-with: GHC == 9.4.4+ , GHC == 9.2.1, GHC == 9.2.2, GHC == 9.2.5 , GHC == 9.0.1, GHC == 9.0.2 , GHC == 8.10.1, GHC == 8.10.2, GHC == 8.10.3, GHC == 8.10.4, GHC == 8.10.5, GHC == 8.10.6, GHC == 8.10.7 , GHC == 8.8.1, GHC == 8.8.2, GHC == 8.8.3@@ -33,17 +34,17 @@ if impl(ghc >= 9.0) other-modules: Language.Haskell.TH.Compat.Data.Current- build-depends: template-haskell >=2.17+ build-depends: template-haskell else if impl(ghc >= 8.8) other-modules:- Language.Haskell.TH.Compat.Data.V215- build-depends: template-haskell >=2.15+ Language.Haskell.TH.Compat.Data.V216+ build-depends: template-haskell <2.17 else if impl(ghc >= 8.2) other-modules: Language.Haskell.TH.Compat.Data.V214- build-depends: template-haskell >=2.12+ build-depends: template-haskell <2.15 else if impl(ghc >= 8.0) other-modules: