th-abstraction 0.3.0.0 → 0.3.1.0
raw patch · 5 files changed
+35/−3 lines, 5 filesdep ~template-haskellPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: template-haskell
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- src/Language/Haskell/TH/Datatype.hs +2/−2
- test/Main.hs +25/−0
- test/Types.hs +3/−0
- th-abstraction.cabal +1/−1
ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for th-abstraction +## 0.3.1.0 -- 2019-04-28+* Fix a bug which would cause data family information to be reified incorrectly+ with GHC 8.8+ in some situations.+ ## 0.3.0.0 -- 2019-04-26 * Breaking change: the `datatypeVars` field of `DatatypeInfo` is now of type `[TyVarBndr]` instead of `[Type]`, as it now refers to all of the bound type
src/Language/Haskell/TH/Datatype.hs view
@@ -566,14 +566,14 @@ , NewtypeInstD cx mbInstVars nts k c deriv <- instD , con :| ts <- decomposeType nts = NewtypeInstD cx mbInstVars- (foldl' AppT con (repairVarKindsWith (fromMaybe dvars mbInstVars) ts))+ (foldl' AppT con (repairVarKindsWith dvars ts)) k c deriv | DataFamilyD _ dvars _ <- famD , DataInstD cx mbInstVars nts k c deriv <- instD , con :| ts <- decomposeType nts = DataInstD cx mbInstVars- (foldl' AppT con (repairVarKindsWith (fromMaybe dvars mbInstVars) ts))+ (foldl' AppT con (repairVarKindsWith dvars ts)) k c deriv # elif MIN_VERSION_template_haskell(2,11,0) | DataFamilyD _ dvars _ <- famD
test/Main.hs view
@@ -72,6 +72,7 @@ famLocalDecTest2 recordFamTest t46Test+ t73Test #endif fixityLookupTest #if __GLASGOW_HASKELL__ >= 704@@ -648,6 +649,30 @@ unless (null ctxt) (fail "regression test for ticket #46 failed") _ -> fail "T46 should have exactly one constructor" [| return () |])++t73Test :: IO ()+t73Test =+ $(do info <- reifyDatatype 'MkT73+ let b = mkName "b"+ bTvb = KindedTV b starK+ bVar = VarT b+ validateDI info+ DatatypeInfo+ { datatypeName = ''T73+ , datatypeContext = []+ , datatypeVars = [bTvb]+ , datatypeInstTypes = [ConT ''Int, SigT bVar starK]+ , datatypeVariant = DataInstance+ , datatypeCons =+ [ ConstructorInfo+ { constructorName = 'MkT73+ , constructorVars = []+ , constructorContext = []+ , constructorFields = [bVar]+ , constructorStrictness = [notStrictAnnot]+ , constructorVariant = NormalConstructor }]+ }+ ) #endif fixityLookupTest :: IO ()
test/Types.hs view
@@ -108,6 +108,9 @@ data family T46 a b c data instance T46 (f (p :: *)) (f p) q = MkT46 q++data family T73 a b+data instance T73 Int b = MkT73 b #endif #if __GLASGOW_HASKELL__ >= 704
th-abstraction.cabal view
@@ -1,5 +1,5 @@ name: th-abstraction-version: 0.3.0.0+version: 0.3.1.0 synopsis: Nicer interface for reified information about data types description: This package normalizes variations in the interface for inspecting datatype information via Template Haskell