Skip to content

Commit dcac014

Browse files
authored
Merge pull request #127 from well-typed/th-abstraction-0.4
Use th-abstraction-0.4, support GHC-9.0
2 parents 6a14a40 + 8d469d6 commit dcac014

File tree

5 files changed

+20
-11
lines changed

5 files changed

+20
-11
lines changed

generics-sop/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.5.1.1 (2020-xx-yy)
2+
3+
* Compatibility with GHC-9.0
4+
15
# 0.5.1.0 (2020-03-29)
26

37
* Compatibility with GHC-8.10 (thanks to Ryan Scott).

generics-sop/generics-sop.cabal

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: generics-sop
2-
version: 0.5.1.0
2+
version: 0.5.1.1
33
synopsis: Generic Programming using True Sums of Products
44
description:
55
A library to support the definition of generic functions.
@@ -65,11 +65,11 @@ library
6565
Generics.SOP.NP
6666
Generics.SOP.NS
6767
Generics.SOP.Sing
68-
build-depends: base >= 4.9 && < 4.15,
68+
build-depends: base >= 4.9 && < 4.16,
6969
sop-core == 0.5.0.*,
70-
template-haskell >= 2.8 && < 2.17,
71-
th-abstraction >= 0.3 && < 0.5,
72-
ghc-prim >= 0.3 && < 0.7
70+
template-haskell >= 2.8 && < 2.18,
71+
th-abstraction >= 0.4 && < 0.5,
72+
ghc-prim >= 0.3 && < 0.8
7373
hs-source-dirs: src
7474
default-language: Haskell2010
7575
ghc-options: -Wall

generics-sop/src/Generics/SOP/Instances.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,9 @@ deriveGeneric ''SrcLoc -- new
262262
deriveGeneric ''RuntimeRep -- new
263263
deriveGeneric ''VecCount -- new
264264
deriveGeneric ''VecElem -- new
265+
#if !MIN_VERSION_base(4,15,0)
265266
deriveGeneric ''SpecConstrAnnotation -- new
267+
#endif
266268

267269
-- From GHC.Generics:
268270
deriveGeneric ''GHC.Generics.K1 -- new

generics-sop/src/Generics/SOP/TH.hs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import Control.Monad (join, replicateM, unless)
1414
import Data.List (foldl')
1515
import Data.Maybe (fromMaybe)
1616
import Data.Proxy
17+
18+
-- importing in this order to avoid unused import warning
19+
import Language.Haskell.TH.Datatype.TyVarBndr
1720
import Language.Haskell.TH
1821
import Language.Haskell.TH.Datatype as TH
1922

@@ -186,22 +189,22 @@ deriveMetadataType n datatypeInfoName = do
186189
[ tySynD datatypeInfoName' [] (metadataType' variant name cons) ]
187190

188191
deriveGenericForDataDec ::
189-
(Name -> Q Type) -> DatatypeVariant -> Cxt -> Name -> [TyVarBndr] -> [Type] -> [TH.ConstructorInfo] -> Q [Dec]
192+
(Name -> Q Type) -> DatatypeVariant -> Cxt -> Name -> [TyVarBndrUnit] -> [Type] -> [TH.ConstructorInfo] -> Q [Dec]
190193
deriveGenericForDataDec f _variant _cxt name _bndrs instTys cons = do
191194
let typ = appTysSubst f name instTys
192195
deriveGenericForDataType f typ cons
193196

194197
deriveGenericForDataType :: (Name -> Q Type) -> Q Type -> [TH.ConstructorInfo] -> Q [Dec]
195198
deriveGenericForDataType f typ cons = do
196-
let codeSyn = tySynInstDCompat ''Code Nothing [typ] (codeFor f cons)
199+
let codeSyn = tySynInstDCompat ''Generics.SOP.Universe.Code Nothing [typ] (codeFor f cons)
197200
inst <- instanceD
198201
(cxt [])
199202
[t| Generic $typ |]
200203
[codeSyn, embedding 'from cons, projection 'to cons]
201204
return [inst]
202205

203206
deriveMetadataForDataDec ::
204-
(Name -> Q Type) -> DatatypeVariant -> Cxt -> Name -> [TyVarBndr] -> [Type] -> [TH.ConstructorInfo] -> Q [Dec]
207+
(Name -> Q Type) -> DatatypeVariant -> Cxt -> Name -> [TyVarBndrUnit] -> [Type] -> [TH.ConstructorInfo] -> Q [Dec]
205208
deriveMetadataForDataDec f variant _cxt name _bndrs instTys cons = do
206209
let typ = appTysSubst f name instTys
207210
deriveMetadataForDataType variant name typ cons
@@ -508,7 +511,7 @@ promotedTypeListSubst f (t:ts) = [t| $promotedConsT $(t >>= substType f) $(promo
508511
appsT :: Name -> [Q Type] -> Q Type
509512
appsT n = foldl' appT (conT n)
510513

511-
appTyVars :: (Name -> Q Type) -> Name -> [TyVarBndr] -> Q Type
514+
appTyVars :: (Name -> Q Type) -> Name -> [TyVarBndrUnit] -> Q Type
512515
appTyVars f n bndrs =
513516
appsT n (map (f . tvName) bndrs)
514517

@@ -545,7 +548,7 @@ withDataDec :: TH.DatatypeInfo
545548
-- The datatype context
546549
-> Name
547550
-- The data type's name
548-
-> [TyVarBndr]
551+
-> [TyVarBndrUnit]
549552
-- The datatype's type variable binders, both implicit and explicit.
550553
-- Examples:
551554
--

sop-core/sop-core.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ library
4141
Data.SOP.NP
4242
Data.SOP.NS
4343
Data.SOP.Sing
44-
build-depends: base >= 4.9 && < 4.15,
44+
build-depends: base >= 4.9 && < 4.16,
4545
deepseq >= 1.3 && < 1.5
4646
hs-source-dirs: src
4747
default-language: Haskell2010

0 commit comments

Comments
 (0)