th-expand-syns 0.4.11.0 → 0.4.12.0
raw patch · 5 files changed
+22/−118 lines, 5 filesdep ~basedep ~template-haskellPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, template-haskell
API changes (from Hackage documentation)
Files
- Language/Haskell/TH/ExpandSyns.hs +7/−76
- Language/Haskell/TH/ExpandSyns/SemigroupCompat.hs +0/−17
- changelog.markdown +4/−0
- testing/Main.hs +1/−13
- th-expand-syns.cabal +10/−12
Language/Haskell/TH/ExpandSyns.hs view
@@ -13,24 +13,15 @@ import Language.Haskell.TH.Datatype import Language.Haskell.TH.Datatype.TyVarBndr-import Language.Haskell.TH.ExpandSyns.SemigroupCompat as Sem import Language.Haskell.TH hiding(cxt) import qualified Data.Map as Map import Data.Map (Map)+import Data.Semigroup as Sem import qualified Data.Set as Set import Data.Generics import Control.Monad import Prelude -#if !(MIN_VERSION_base(4,8,0))-import Control.Applicative-#endif---- For ghci-#ifndef MIN_VERSION_template_haskell-#define MIN_VERSION_template_haskell(X,Y,Z) 1-#endif- packagename :: String packagename = "th-expand-syns" @@ -68,13 +59,7 @@ noWarnTypeFamilies = mempty { sesWarnTypeFamilies = False } warn :: String -> Q ()-warn msg =-#if MIN_VERSION_template_haskell(2,8,0)- reportWarning-#else- report False-#endif- (packagename ++": WARNING: "++msg)+warn msg = reportWarning (packagename ++": WARNING: "++msg) warnIfNameIsTypeFamily :: Name -> Q () warnIfNameIsTypeFamily n = do@@ -83,9 +68,7 @@ ClassI {} -> return () ClassOpI {} -> return () TyConI d -> warnIfDecIsTypeFamily d-#if MIN_VERSION_template_haskell(2,7,0) FamilyI d _ -> warnIfDecIsTypeFamily d -- Called for warnings-#endif PrimTyConI {} -> return () DataConI {} -> return () VarI {} -> return ()@@ -98,19 +81,8 @@ warnIfDecIsTypeFamily = go where go (TySynD {}) = return ()--#if MIN_VERSION_template_haskell(2,11,0) go (OpenTypeFamilyD (TypeFamilyHead name _ _ _)) = maybeWarnTypeFamily name go (ClosedTypeFamilyD (TypeFamilyHead name _ _ _) _) = maybeWarnTypeFamily name-#else--#if MIN_VERSION_template_haskell(2,9,0)- go (ClosedTypeFamilyD name _ _ _) = maybeWarnTypeFamily name-#endif-- go (FamilyD TypeFam name _ _) = maybeWarnTypeFamily name-#endif- go (FunD {}) = return () go (ValD {}) = return () go (DataD {}) = return ()@@ -119,32 +91,16 @@ go (InstanceD {}) = return () go (SigD {}) = return () go (ForeignD {}) = return ()--#if MIN_VERSION_template_haskell(2,8,0) go (InfixD {}) = return ()-#endif- go (PragmaD {}) = return ()- -- Nothing to expand for data families, so no warning-#if MIN_VERSION_template_haskell(2,11,0) go (DataFamilyD {}) = return ()-#else- go (FamilyD DataFam _ _ _) = return ()-#endif- go (DataInstD {}) = return () go (NewtypeInstD {}) = return () go (TySynInstD {}) = return ()--#if MIN_VERSION_template_haskell(2,9,0) go (RoleAnnotD {}) = return ()-#endif--#if MIN_VERSION_template_haskell(2,10,0) go (StandaloneDerivD {}) = return () go (DefaultSigD {}) = return ()-#endif #if MIN_VERSION_template_haskell(2,12,0) go (PatSynD {}) = return ()@@ -173,19 +129,16 @@ go :: Type -> Q () go (ConT n) = warnIfNameIsTypeFamily n go (AppT t1 t2) = go t1 >> go t2- go (SigT t k) = go t >> go_kind k+ go (SigT t k) = go t >> go k go ListT{} = return () go ArrowT{} = return () go VarT{} = return () go TupleT{} = return () go (ForallT tvbs ctxt body) = do- mapM_ (go_kind . tvKind) tvbs- mapM_ go_pred ctxt+ mapM_ (go . tvKind) tvbs+ mapM_ go ctxt go body-#if MIN_VERSION_template_haskell(2,6,0) go UnboxedTupleT{} = return ()-#endif-#if MIN_VERSION_template_haskell(2,8,0) go PromotedT{} = return () go PromotedTupleT{} = return () go PromotedConsT{} = return ()@@ -193,11 +146,7 @@ go StarT{} = return () go ConstraintT{} = return () go LitT{} = return ()-#endif-#if MIN_VERSION_template_haskell(2,10,0) go EqualityT{} = return ()-#endif-#if MIN_VERSION_template_haskell(2,11,0) go (InfixT t1 n t2) = do warnIfNameIsTypeFamily n go t1@@ -208,17 +157,16 @@ go t2 go (ParensT t) = go t go WildCardT{} = return ()-#endif #if MIN_VERSION_template_haskell(2,12,0) go UnboxedSumT{} = return () #endif #if MIN_VERSION_template_haskell(2,15,0)- go (AppKindT t k) = go t >> go_kind k+ go (AppKindT t k) = go t >> go k go (ImplicitParamT _ t) = go t #endif #if MIN_VERSION_template_haskell(2,16,0) go (ForallVisT tvbs body) = do- mapM_ (go_kind . tvKind) tvbs+ mapM_ (go . tvKind) tvbs go body #endif #if MIN_VERSION_template_haskell(2,17,0)@@ -235,21 +183,6 @@ go t2 #endif - go_kind :: Kind -> Q ()-#if MIN_VERSION_template_haskell(2,8,0)- go_kind = go-#else- go_kind _ = return ()-#endif-- go_pred :: Pred -> Q ()-#if MIN_VERSION_template_haskell(2,10,0)- go_pred = go-#else- go_pred (ClassP _ ts) = mapM_ go ts- go_pred (EqualP t1 t2) = go t1 >> go t2-#endif- maybeWarnTypeFamily :: Name -> Q () maybeWarnTypeFamily name = warn ("Type synonym families (and associated type synonyms) are currently not supported (they won't be expanded). Name of unsupported family: "++show name)@@ -323,12 +256,10 @@ ForallC (map (mapTVKind (applySubstitution vts')) vars') (applySubstitution vts' cxt) (Map.foldrWithKey (\v t -> substInCon (v, t)) body vts')-#if MIN_VERSION_template_haskell(2,11,0) go c@GadtC{} = errGadt c go c@RecGadtC{} = errGadt c errGadt c = error (packagename++": substInCon currently doesn't support GADT constructors with GHC >= 8 ("++pprint c++")")-#endif -- Apply a substitution to something underneath a @forall@. The continuation -- argument provides new substitutions and fresh type variable binders to avoid
− Language/Haskell/TH/ExpandSyns/SemigroupCompat.hs
@@ -1,17 +0,0 @@-{-# LANGUAGE CPP #-}-module Language.Haskell.TH.ExpandSyns.SemigroupCompat(Semigroup(..), Monoid(..)) where--#if MIN_VERSION_base(4,9,0)--import Data.Semigroup--#else--import Data.Monoid(Monoid(..))-import Prelude--infixr 6 <>-class Semigroup a where- (<>) :: a -> a -> a--#endif
changelog.markdown view
@@ -1,3 +1,7 @@+## 0.4.12.0 [2024.12.05]++* Drop support for pre-8.0 versions of GHC.+ ## 0.4.11.0 [2023.01.31] * Support `TypeDataD` when building with `template-haskell-2.20.0.0` (GHC 9.6)
testing/Main.hs view
@@ -18,23 +18,13 @@ -- GHC 7.8 always seems to consider the body of 'ForallT' to have a 'PlainTV', -- whereas it always has a 'KindedTV' with GHC 7.10 (in both cases, it doesn't appear -- to matter whether the definition of 'ForAll' is actually written with a kind signature).-#if MIN_VERSION_template_haskell(2,10,0)- [t| forall a. Show a => a -> (forall (x :: *). [] x) -> (Int,[] Integer) |]-#else- [t| forall a. Show a => a -> (forall x. [] x) -> (Int,[] Integer) |]-#endif-- )+ [t| forall a. Show a => a -> (forall (x :: *). [] x) -> (Int,[] Integer) |]) putStrLn "Variable capture avoidance test..." $(let -- See comment about 'PlainTV'/'KindedTV' above-#if MIN_VERSION_template_haskell(2,10,0) y_0 = kindedTVSpecified (mkName "y_0") StarT-#else- y_0 = plainTVSpecified (mkName "y_0")-#endif expectedExpansion = forallT@@ -68,12 +58,10 @@ [t| Int'' |] [t| Int |]) -#if MIN_VERSION_template_haskell(2,8,0) putStrLn "Synonyms in kinds" $(mkTest (sigT (conT ''Int) (ConT ''Id `AppT` StarT)) (sigT (conT ''Int) StarT))-#endif $(do reportWarning "No warning about type families should appear after this line." -- TODO: Automate this test with a custom Quasi instance?
th-expand-syns.cabal view
@@ -1,5 +1,5 @@ name: th-expand-syns-version: 0.4.11.0+version: 0.4.12.0 synopsis: Expands type synonyms in Template Haskell ASTs description: Expands type synonyms in Template Haskell ASTs. .@@ -17,12 +17,6 @@ extra-source-files: changelog.markdown homepage: https://github.com/DanielSchuessler/th-expand-syns tested-with:- GHC == 7.0.4- GHC == 7.2.2- GHC == 7.4.2- GHC == 7.6.3- GHC == 7.8.4- GHC == 7.10.3 GHC == 8.0.2 GHC == 8.2.2 GHC == 8.4.4@@ -30,21 +24,25 @@ GHC == 8.8.4 GHC == 8.10.7 GHC == 9.0.2- GHC == 9.2.2+ GHC == 9.2.8+ GHC == 9.4.8+ GHC == 9.6.6+ GHC == 9.8.4+ GHC == 9.10.1+ GHC == 9.12.1 source-repository head type: git location: https://github.com/DanielSchuessler/th-expand-syns.git Library- build-depends: base >= 4.3 && < 5+ build-depends: base >= 4.9 && < 5 , containers , syb- , th-abstraction >= 0.4.3 && < 0.5- , template-haskell >= 2.5 && < 2.21+ , th-abstraction >= 0.4.3 && < 0.8+ , template-haskell >= 2.11 && < 2.24 ghc-options: -Wall exposed-modules: Language.Haskell.TH.ExpandSyns- other-modules: Language.Haskell.TH.ExpandSyns.SemigroupCompat default-language: Haskell2010 Test-Suite test-th-expand-syns