template-haskell-optics 0.2 → 0.3
raw patch · 3 files changed
+67/−5 lines, 3 filesdep ~template-haskelldep ~th-abstractionnew-uploader
Dependency ranges changed: template-haskell, th-abstraction
Files
- CHANGELOG.md +3/−0
- src/Language/Haskell/TH/Optics.hs +60/−1
- template-haskell-optics.cabal +4/−4
CHANGELOG.md view
@@ -1,3 +1,6 @@+# template-haskell-optics-0.3 (2023-11-16)+* Add support for GHC 9.4 to 9.8+ # template-haskell-optics-0.2 (2022-03-22) * Add support for GHC 9.0 and 9.2 * Drop the `DataPrim` type synonym
src/Language/Haskell/TH/Optics.hs view
@@ -92,6 +92,9 @@ , _SigD , _ForeignD , _InfixD+#if MIN_VERSION_template_haskell(2,19,0)+ , _DefaultD+#endif , _PragmaD , _DataInstD , _NewtypeInstD@@ -499,6 +502,14 @@ #if MIN_VERSION_template_haskell(2,17,0) t@MulArrowT{} -> pure t #endif+#if MIN_VERSION_template_haskell(2,19,0)+ PromotedInfixT t1 n t2 -> InfixT <$> traverseOf (typeVarsEx s) f t1+ <*> pure n+ <*> traverseOf (typeVarsEx s) f t2+ PromotedUInfixT t1 n t2 -> UInfixT <$> traverseOf (typeVarsEx s) f t1+ <*> pure n+ <*> traverseOf (typeVarsEx s) f t2+#endif instance HasTypeVars Con where typeVarsEx s = traversalVL $ \f -> \case@@ -570,6 +581,12 @@ #if MIN_VERSION_template_haskell(2,17,0) substType _ t@MulArrowT{} = t #endif+#if MIN_VERSION_template_haskell(2,19,0)+ substType m (PromotedInfixT t1 n t2) =+ PromotedInfixT (substType m t1) n (substType m t2)+ substType m (PromotedUInfixT t1 n t2) =+ PromotedUInfixT (substType m t1) n (substType m t2)+#endif instance SubstType t => SubstType [t] where substType = map . substType@@ -694,7 +711,11 @@ g (TypeFamilyHead n _ _ _ ) = n s (TypeFamilyHead _ tvbs rs ia) n = TypeFamilyHead n tvbs rs ia +#if MIN_VERSION_template_haskell(2,21,0)+typeFamilyHeadTyVarBndrs :: Lens' TypeFamilyHead [TyVarBndr BndrVis]+#else typeFamilyHeadTyVarBndrs :: Lens' TypeFamilyHead [TyVarBndrUnit]+#endif typeFamilyHeadTyVarBndrs = lens g s where g (TypeFamilyHead _ tvbs _ _ ) = tvbs s (TypeFamilyHead n _ rs ia) tvbs = TypeFamilyHead n tvbs rs ia@@ -817,7 +838,11 @@ remitter (ValD x y z) = Just (x, y, z) remitter _ = Nothing +#if MIN_VERSION_template_haskell(2,21,0)+_TySynD :: Prism' Dec (Name, [TyVarBndr BndrVis], Type)+#else _TySynD :: Prism' Dec (Name, [TyVarBndrUnit], Type)+#endif _TySynD = prism' reviewer remitter where@@ -825,7 +850,11 @@ remitter (TySynD x y z) = Just (x, y, z) remitter _ = Nothing +#if MIN_VERSION_template_haskell(2,21,0)+_ClassD :: Prism' Dec (Cxt, Name, [TyVarBndr BndrVis], [FunDep], [Dec])+#else _ClassD :: Prism' Dec (Cxt, Name, [TyVarBndrUnit], [FunDep], [Dec])+#endif _ClassD = prism' reviewer remitter where@@ -893,6 +922,16 @@ remitter (InfixD x y) = Just (x, y) remitter _ = Nothing +#if MIN_VERSION_template_haskell(2,19,0)+_DefaultD :: Prism' Dec [Type]+_DefaultD+ = prism' reviewer remitter+ where+ reviewer = DefaultD+ remitter (DefaultD ts) = Just ts+ remitter _ = Nothing+#endif+ _PragmaD :: Prism' Dec Pragma _PragmaD = prism' reviewer remitter@@ -961,7 +1000,15 @@ -- _DataInstD :: 'Prism'' 'Dec' ('Cxt', 'Maybe' ['TyVarBndrUnit'], 'Type', 'Maybe' 'Kind', ['Con'], ['DerivClause']) -- template-haskell-2.15+ -- _DataInstD :: 'Prism'' 'Dec' ('Cxt', 'Name', ['Type'], 'Maybe' 'Kind', ['Con'], ['DerivClause']) -- Earlier versions -- @-#if MIN_VERSION_template_haskell(2,15,0)+#if MIN_VERSION_template_haskell(2,21,0)+_DataInstD :: Prism' Dec (Cxt, Maybe [TyVarBndr ()], Type, Maybe Kind, [Con], [DerivClause])+_DataInstD+ = prism' reviewer remitter+ where+ reviewer (x, y, z, w, u, v) = DataInstD x y z w u v+ remitter (DataInstD x y z w u v) = Just (x, y, z, w, u, v)+ remitter _ = Nothing+#elif MIN_VERSION_template_haskell(2,15,0) _DataInstD :: Prism' Dec (Cxt, Maybe [TyVarBndrUnit], Type, Maybe Kind, [Con], [DerivClause]) _DataInstD = prism' reviewer remitter@@ -1002,7 +1049,11 @@ remitter _ = Nothing #endif +#if MIN_VERSION_template_haskell(2,21,0)+_DataD :: Prism' Dec (Cxt, Name, [TyVarBndr BndrVis], Maybe Kind, [Con], [DerivClause])+#else _DataD :: Prism' Dec (Cxt, Name, [TyVarBndrUnit], Maybe Kind, [Con], [DerivClause])+#endif _DataD = prism' reviewer remitter where@@ -1010,7 +1061,11 @@ remitter (DataD x y z w u v) = Just (x, y, z, w, u, v) remitter _ = Nothing +#if MIN_VERSION_template_haskell(2,21,0)+_NewtypeD :: Prism' Dec (Cxt, Name, [TyVarBndr BndrVis], Maybe Kind, Con, [DerivClause])+#else _NewtypeD :: Prism' Dec (Cxt, Name, [TyVarBndrUnit], Maybe Kind, Con, [DerivClause])+#endif _NewtypeD = prism' reviewer remitter where@@ -1018,7 +1073,11 @@ remitter (NewtypeD x y z w u v) = Just (x, y, z, w, u, v) remitter _ = Nothing +#if MIN_VERSION_template_haskell(2,21,0)+_DataFamilyD :: Prism' Dec (Name, [TyVarBndr BndrVis], Maybe Kind)+#else _DataFamilyD :: Prism' Dec (Name, [TyVarBndrUnit], Maybe Kind)+#endif _DataFamilyD = prism' reviewer remitter where
template-haskell-optics.cabal view
@@ -1,5 +1,5 @@ name: template-haskell-optics-version: 0.2+version: 0.3 license: BSD3 license-file: LICENSE build-type: Simple@@ -7,7 +7,7 @@ author: Andrzej Rybczak cabal-version: 1.18 tested-with: GHC ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.7- || ==9.0.2 || ==9.2.2, GHCJS ==8.4+ || ==9.0.2 || ==9.2.8 || ==9.4.8 || ==9.6.3 || ==9.8.1, GHCJS ==8.4 synopsis: Optics for template-haskell types category: Data, Optics, Lenses description:@@ -32,7 +32,7 @@ build-depends: base >= 4.10 && <5 , optics-core >= 0.4 && <0.5 , containers >= 0.5.10.2 && <0.7- , template-haskell >= 2.12 && <2.19- , th-abstraction >= 0.4 && <0.5+ , template-haskell >= 2.12 && <2.22+ , th-abstraction >= 0.4 && <0.7 exposed-modules: Language.Haskell.TH.Optics