th-data-compat 0.0.1.0 → 0.0.2.0
raw patch · 4 files changed
+25/−12 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Language.Haskell.TH.Compat.Data: unInstanceD :: Dec -> Maybe (Cxt, Type, [Dec])
Files
- src/Language/Haskell/TH/Compat/Data.hs +1/−1
- src/Language/Haskell/TH/Compat/Data/Current.hs +11/−5
- src/Language/Haskell/TH/Compat/Data/V210.hs +12/−5
- th-data-compat.cabal +1/−1
src/Language/Haskell/TH/Compat/Data.hs view
@@ -16,7 +16,7 @@ dataD', newtypeD', dataInstD', newtypeInstD', -- * Interfaces to destruct data declarations- unDataD, unNewtypeD, unDataInstD, unNewtypeInstD,+ unDataD, unNewtypeD, unDataInstD, unNewtypeInstD, unInstanceD, ) where #if MIN_VERSION_template_haskell(2,11,0)
src/Language/Haskell/TH/Compat/Data/Current.hs view
@@ -3,12 +3,13 @@ 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),+ Dec (DataD, NewtypeD, DataInstD, NewtypeInstD, InstanceD), dataD, newtypeD, dataInstD, newtypeInstD, conT) @@ -18,7 +19,7 @@ -> DecQ dataD' cxt n bs cs ds = dataD cxt n bs Nothing cs $ mapM conT ds --- | Compatible interface to destruct DataD+-- | 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) unDataD _ = Nothing@@ -29,7 +30,7 @@ -> DecQ newtypeD' cxt n bs c ds = newtypeD cxt n bs Nothing c $ mapM conT ds --- | Compatible interface to destruct NewtypeD+-- | 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) unNewtypeD _ = Nothing@@ -40,7 +41,7 @@ -> DecQ dataInstD' cxt n as cs ds = dataInstD cxt n as Nothing cs $ mapM conT ds --- | Compatible interface to destruct DataInstD+-- | Compatible interface to destruct 'DataInstD' unDataInstD :: Dec -> Maybe (Cxt, Name, [Type], Maybe Kind, [Con], [Type]) unDataInstD (DataInstD cxt n as mk cs ds) = Just (cxt, n, as, mk, cs, ds) unDataInstD _ = Nothing@@ -51,7 +52,12 @@ -> DecQ newtypeInstD' cxt n as c ds = newtypeInstD cxt n as Nothing c $ mapM conT ds --- | Compatible interface to destruct NewtypeInstD+-- | Compatible interface to destruct 'NewtypeInstD' unNewtypeInstD :: Dec -> Maybe (Cxt, Name, [Type], Maybe Kind, Con, [Type]) unNewtypeInstD (NewtypeInstD cxt n as mk c ds) = Just (cxt, n, as, mk, c, ds) unNewtypeInstD _ = Nothing++-- | Compatible interface to destruct 'InstanceD'+-- No Overlap type is defined before template-haskell-2.11.+unInstanceD (InstanceD _ cxt ty decs) = Just (cxt, ty, decs)+unInstanceD _ = Nothing
src/Language/Haskell/TH/Compat/Data/V210.hs view
@@ -3,12 +3,13 @@ newtypeD', unNewtypeD, dataInstD', unDataInstD, newtypeInstD', unNewtypeInstD,+ unInstanceD, ) where import Language.Haskell.TH (CxtQ, ConQ, TypeQ, DecQ, Cxt, Con, Type (ConT), Name, TyVarBndr, Kind,- Dec (DataD, NewtypeD, DataInstD, NewtypeInstD),+ Dec (DataD, NewtypeD, DataInstD, NewtypeInstD, InstanceD), dataD, newtypeD, dataInstD, newtypeInstD) @@ -18,7 +19,7 @@ -> DecQ dataD' = dataD --- | Compatible interface to destruct DataD+-- | Compatible interface to destruct 'DataD' unDataD :: Dec -> Maybe (Cxt, Name, [TyVarBndr], Maybe Kind, [Con], [Type]) unDataD (DataD cxt n bs cs ds) = Just (cxt, n, bs, Nothing, cs, map ConT ds) unDataD _ = Nothing@@ -29,7 +30,7 @@ -> DecQ newtypeD' = newtypeD --- | Compatible interface to destruct NewtypeD+-- | Compatible interface to destruct 'NewtypeD' unNewtypeD :: Dec -> Maybe (Cxt, Name, [TyVarBndr], Maybe Kind, Con, [Type]) unNewtypeD (NewtypeD cxt n bs c ds) = Just (cxt, n, bs, Nothing, c, map ConT ds) unNewtypeD _ = Nothing@@ -40,7 +41,7 @@ -> DecQ dataInstD' = dataInstD --- | Compatible interface to destruct DataInstD+-- | Compatible interface to destruct 'DataInstD' unDataInstD :: Dec -> Maybe (Cxt, Name, [Type], Maybe Kind, [Con], [Type]) unDataInstD (DataInstD cxt n as cs ds) = Just (cxt, n, as, Nothing, cs, map ConT ds) unDataInstD _ = Nothing@@ -51,7 +52,13 @@ -> DecQ newtypeInstD' = newtypeInstD --- | Compatible interface to destruct NewtypeInstD+-- | Compatible interface to destruct 'NewtypeInstD' unNewtypeInstD :: Dec -> Maybe (Cxt, Name, [Type], Maybe Kind, Con, [Type]) unNewtypeInstD (NewtypeInstD cxt n as c ds) = Just (cxt, n, as, Nothing, c, map ConT ds) 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.0.1.0+version: 0.0.2.0 synopsis: Compatibility for data definition template of TH description: This package contains wrapped name definitions of data definition template