Hello community,

here is the log from the commit of package ghc-th-utilities for 
openSUSE:Factory checked in at 2019-05-12 11:36:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-th-utilities (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-th-utilities.new.5148 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-th-utilities"

Sun May 12 11:36:34 2019 rev:7 rq:701775 version:0.2.3.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-th-utilities/ghc-th-utilities.changes        
2019-01-25 22:43:34.739212401 +0100
+++ 
/work/SRC/openSUSE:Factory/.ghc-th-utilities.new.5148/ghc-th-utilities.changes  
    2019-05-12 11:36:38.194438636 +0200
@@ -1,0 +2,20 @@
+Mon May  6 02:01:42 UTC 2019 - [email protected]
+
+- Update th-utilities to version 0.2.3.0.
+  ## 0.2.3.0
+
+  * Improved fix to the type variable behavior with GHC <= 7.10.  Uses
+    `Any` in place of type variables instead of `()`, to allow for more
+    kinds than just `*` and `Constraint`.
+
+  ## 0.2.2.0
+
+  * Fixes derive and instantiator mechanisms to work with ghc 7.10 and
+    earlier.  Previously, invocation was broken when type variables were
+    used.
+
+  * Fixes `freeVarsT` - it now looks through more constructors of `Type`.
+
+  * Adds `dequalifyTyVars` to dequalify every type variable.
+
+-------------------------------------------------------------------

Old:
----
  th-utilities-0.2.1.0.tar.gz

New:
----
  th-utilities-0.2.3.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-th-utilities.spec ++++++
--- /var/tmp/diff_new_pack.CiLwiY/_old  2019-05-12 11:36:38.946440838 +0200
+++ /var/tmp/diff_new_pack.CiLwiY/_new  2019-05-12 11:36:38.954440861 +0200
@@ -19,7 +19,7 @@
 %global pkg_name th-utilities
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.2.1.0
+Version:        0.2.3.0
 Release:        0
 Summary:        Collection of useful functions for use with Template Haskell
 License:        MIT

++++++ th-utilities-0.2.1.0.tar.gz -> th-utilities-0.2.3.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/th-utilities-0.2.1.0/ChangeLog.md 
new/th-utilities-0.2.3.0/ChangeLog.md
--- old/th-utilities-0.2.1.0/ChangeLog.md       2019-01-09 05:57:34.000000000 
+0100
+++ new/th-utilities-0.2.3.0/ChangeLog.md       2019-05-05 23:12:52.000000000 
+0200
@@ -1,5 +1,21 @@
 # ChangeLog
 
+## 0.2.3.0
+
+* Improved fix to the type variable behavior with GHC <= 7.10.  Uses
+  `Any` in place of type variables instead of `()`, to allow for more
+  kinds than just `*` and `Constraint`.
+
+## 0.2.2.0
+
+* Fixes derive and instantiator mechanisms to work with ghc 7.10 and
+  earlier.  Previously, invocation was broken when type variables were
+  used.
+
+* Fixes `freeVarsT` - it now looks through more constructors of `Type`.
+
+* Adds `dequalifyTyVars` to dequalify every type variable.
+
 ## 0.2.0.1
 
 * Fixes build on 7.8
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/th-utilities-0.2.1.0/src/TH/Derive.hs 
new/th-utilities-0.2.3.0/src/TH/Derive.hs
--- old/th-utilities-0.2.1.0/src/TH/Derive.hs   2019-01-09 05:54:24.000000000 
+0100
+++ new/th-utilities-0.2.3.0/src/TH/Derive.hs   2019-05-05 23:07:34.000000000 
+0200
@@ -67,6 +67,7 @@
 import TH.Utilities
 import TH.Derive.Internal
 import TH.Derive.Storable ()
+import GHC.Exts (Any)
 
 --TODO: support deriving on constraint kinds, for concision!
 
@@ -84,12 +85,12 @@
     toStmt (varName, dec) = case fromPlainInstanceD dec of
         Just (preds, AppT (ConT ((== ''Deriving) -> True)) cls, []) ->
             bindS (varP varName)
-                  [e| runDeriver $(proxyE (return cls))
+                  [e| runDeriver $(proxyE (return (tyVarsToAny cls)))
                                  preds
                                  cls |]
         Just (preds, ty, decs) ->
             bindS (varP varName)
-                  [e| runInstantiator $(proxyE (return ty))
+                  [e| runInstantiator $(proxyE (return (tyVarsToAny ty)))
                                       preds
                                       ty
                                       decs |]
@@ -97,6 +98,18 @@
             "Expected deriver or instantiator, instead got:\n" ++
             show dec
 
+-- | Turn type variables into uses of 'Any'.
+--
+-- The purpose of this is to avoid errors such as described in
+-- https://github.com/fpco/store/issues/140 .  The problem is that
+-- older GHC versions (<= 7.10) have a bug where they expect type
+-- variables in expressions to be in scope.
+tyVarsToAny :: Data a => a -> a
+tyVarsToAny = everywhere (id `extT` modifyType)
+  where
+    modifyType (VarT _) = ConT ''Any
+    modifyType ty = ty
+
 -- | Useful function for defining 'Instantiator' instances. It uses
 -- 'Data' to generically replace references to the methods with plain
 -- 'Name's. This is handy when you are putting the definitions passed to
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/th-utilities-0.2.1.0/src/TH/Utilities.hs 
new/th-utilities-0.2.3.0/src/TH/Utilities.hs
--- old/th-utilities-0.2.1.0/src/TH/Utilities.hs        2019-01-09 
05:54:24.000000000 +0100
+++ new/th-utilities-0.2.3.0/src/TH/Utilities.hs        2019-05-05 
21:28:16.000000000 +0200
@@ -94,17 +94,18 @@
 dequalify :: Name -> Name
 dequalify = mkName . nameBase
 
+-- | Apply 'dequalify' to every type variable.
+dequalifyTyVars :: Data a => a -> a
+dequalifyTyVars = everywhere (id `extT` modifyType)
+  where
+    modifyType (VarT n) = VarT (dequalify n)
+    modifyType ty = ty
+
 -- | Get the free type variables of a 'Type'.
 freeVarsT :: Type -> [Name]
 freeVarsT (ForallT tvs _ ty) = filter (`notElem` (map tyVarBndrName tvs)) 
(freeVarsT ty)
-freeVarsT (AppT l r) = freeVarsT l ++ freeVarsT r
-freeVarsT (SigT ty k) = freeVarsT ty ++ freeVarsT k
 freeVarsT (VarT n) = [n]
-#if MIN_VERSION_template_haskell(2,11,0)
-freeVarsT (InfixT x n r) = freeVarsT x ++ freeVarsT r
-freeVarsT (UInfixT x n r) = freeVarsT x ++ freeVarsT r
-#endif
-freeVarsT _ = []
+freeVarsT ty = concat $ gmapQ (const [] `extQ` freeVarsT) ty
 
 -- | Utility to conveniently handle change to 'InstanceD' API in
 -- template-haskell-2.11.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/th-utilities-0.2.1.0/th-utilities.cabal 
new/th-utilities-0.2.3.0/th-utilities.cabal
--- old/th-utilities-0.2.1.0/th-utilities.cabal 2019-01-09 06:13:28.000000000 
+0100
+++ new/th-utilities-0.2.3.0/th-utilities.cabal 2019-05-05 23:13:46.000000000 
+0200
@@ -4,10 +4,10 @@
 --
 -- see: https://github.com/sol/hpack
 --
--- hash: f65b38d225125ec3f0a4ec974c8bcae0ae5358894abd8c118aa1a6b3c9b457e7
+-- hash: 7886213bf6588ab61ba8582e6dc179a0d841c4c383fc63021383e7abd1a5dde0
 
 name:           th-utilities
-version:        0.2.1.0
+version:        0.2.3.0
 synopsis:       Collection of useful functions for use with Template Haskell
 category:       Template Haskell
 homepage:       https://github.com/fpco/th-utilities#readme


Reply via email to