packages feed

th-utilities 0.2.2.0 → 0.2.3.0

raw patch · 3 files changed

+20/−8 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -1,5 +1,11 @@ # 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
src/TH/Derive.hs view
@@ -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 (unitTyVars cls)))+                  [e| runDeriver $(proxyE (return (tyVarsToAny cls)))                                  preds                                  cls |]         Just (preds, ty, decs) ->             bindS (varP varName)-                  [e| runInstantiator $(proxyE (return (unitTyVars ty)))+                  [e| runInstantiator $(proxyE (return (tyVarsToAny ty)))                                       preds                                       ty                                       decs |]@@ -97,11 +98,16 @@             "Expected deriver or instantiator, instead got:\n" ++             show dec --- | Turn type variables into unit types.-unitTyVars :: Data a => a -> a-unitTyVars = everywhere (id `extT` modifyType)+-- | 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 _) = TupleT 0+    modifyType (VarT _) = ConT ''Any     modifyType ty = ty  -- | Useful function for defining 'Instantiator' instances. It uses
th-utilities.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: fffcc9b9550bfe2e35141d3aadeb19bc6d5536025381f9c21188fc104a24b062+-- hash: 7886213bf6588ab61ba8582e6dc179a0d841c4c383fc63021383e7abd1a5dde0  name:           th-utilities-version:        0.2.2.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