[arch-commits] Commit in haskell-rank2classes/trunk (PKGBUILD ghc9.patch)

Felix Yan felixonmars at archlinux.org
Mon Jun 21 01:23:33 UTC 2021


    Date: Monday, June 21, 2021 @ 01:23:32
  Author: felixonmars
Revision: 966210

upgpkg: haskell-rank2classes 1.4.1-63: rebuild with ghc 9.0.1

Added:
  haskell-rank2classes/trunk/ghc9.patch
Modified:
  haskell-rank2classes/trunk/PKGBUILD

------------+
 PKGBUILD   |   12 +++++++--
 ghc9.patch |   74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 83 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2021-06-21 01:22:36 UTC (rev 966209)
+++ PKGBUILD	2021-06-21 01:23:32 UTC (rev 966210)
@@ -3,7 +3,7 @@
 _hkgname=rank2classes
 pkgname=haskell-rank2classes
 pkgver=1.4.1
-pkgrel=62
+pkgrel=63
 pkgdesc="Standard type constructor class hierarchy, only with methods of rank 2 types"
 url="https://github.com/blamario/grampa/tree/master/rank2classes"
 license=('BSD')
@@ -11,9 +11,15 @@
 depends=('ghc-libs' 'haskell-distributive')
 makedepends=('ghc' 'haskell-cabal-doctest' 'haskell-doctest' 'haskell-markdown-unlit'
              'haskell-tasty' 'haskell-tasty-hunit')
-source=(https://hackage.haskell.org/packages/archive/${_hkgname}/${pkgver}/${_hkgname}-${pkgver}.tar.gz)
-sha512sums=('5c1c271809d98105c9d0bfa0a453871b4ac322d954ac9a1048d8846081782f5080c7051d3f3d58d8620c8221f3ea5b4761311677ff1968daabc4e5a6dfbc8d5e')
+source=(https://hackage.haskell.org/packages/archive/${_hkgname}/${pkgver}/${_hkgname}-${pkgver}.tar.gz
+        ghc9.patch)
+sha512sums=('5c1c271809d98105c9d0bfa0a453871b4ac322d954ac9a1048d8846081782f5080c7051d3f3d58d8620c8221f3ea5b4761311677ff1968daabc4e5a6dfbc8d5e'
+            '0b80333b0f463ae5b07c90d453526943448e2e5898936fd9cf308e8c2c0864cd77f534e1579dd53ee40dbeeec47ca41b0c8ac982f6fc0ad1fd2d2c85501924ff')
 
+prepare() {
+    patch -d $_hkgname-$pkgver -p2 < ghc9.patch
+}
+
 build() {
     cd $_hkgname-$pkgver
 

Added: ghc9.patch
===================================================================
--- ghc9.patch	                        (rev 0)
+++ ghc9.patch	2021-06-21 01:23:32 UTC (rev 966210)
@@ -0,0 +1,74 @@
+commit 69c30b213fc734ac4b89290e9354dc1304296155
+Author: Felix Yan <felixonmars at archlinux.org>
+Date:   Mon Jun 21 09:21:42 2021 +0800
+
+    Fix compatibility with GHC 9
+
+diff --git a/rank2classes/rank2classes.cabal b/rank2classes/rank2classes.cabal
+index 334ceac..33dbfca 100644
+--- a/rank2classes/rank2classes.cabal
++++ b/rank2classes/rank2classes.cabal
+@@ -43,7 +43,7 @@ library
+                        distributive < 0.7
+ 
+   if flag(use-template-haskell)
+-    build-depends: template-haskell >= 2.11 && < 2.17
++    build-depends: template-haskell >= 2.11 && < 2.18
+     exposed-modules: Rank2.TH
+ 
+ test-suite doctests
+diff --git a/rank2classes/src/Rank2.hs b/rank2classes/src/Rank2.hs
+index 26933eb..75a30f9 100644
+--- a/rank2classes/src/Rank2.hs
++++ b/rank2classes/src/Rank2.hs
+@@ -415,16 +415,16 @@ instance (Apply f, Apply g) => Apply ((Generics.:*:) f g) where
+    (x1 Generics.:*: y1) <*> (x2 Generics.:*: y2) = (x1 <*> x2) Generics.:*: (y1 <*> y2)
+ 
+ instance Applicative Empty where
+-   pure = const Empty
++   pure _ = Empty
+ 
+ instance Applicative Proxy where
+-   pure = const Proxy
++   pure _ = Proxy
+ 
+ instance (Semigroup x, Monoid x) => Applicative (Const x) where
+-   pure = const (Const mempty)
++   pure _ = Const mempty
+ 
+ instance Applicative (Only x) where
+-   pure = Only
++   pure f = Only f
+ 
+ instance Applicative g => Applicative (Identity g) where
+    pure f = Identity (pure f)
+diff --git a/rank2classes/src/Rank2/TH.hs b/rank2classes/src/Rank2/TH.hs
+index b05d3d4..5f85015 100644
+--- a/rank2classes/src/Rank2/TH.hs
++++ b/rank2classes/src/Rank2/TH.hs
+@@ -7,6 +7,7 @@
+ --
+ -- or, if you're picky, you can invoke only 'deriveFunctor' and whichever other instances you need instead.
+ 
++{-# Language CPP #-}
+ {-# Language TemplateHaskell #-}
+ -- Adapted from https://wiki.haskell.org/A_practical_Template_Haskell_Tutorial
+ 
+@@ -98,10 +99,17 @@ reifyConstructors cls ty = do
+       NewtypeD _ nm tyVars kind c _ -> return (nm, tyVars, kind, [c])
+       _ -> fail "deriveApply: tyCon may not be a type synonym."
+  
++#if MIN_VERSION_template_haskell(2,17,0)
++   let (KindedTV tyVar () (AppT (AppT ArrowT StarT) StarT)) = last tyVars
++       instanceType           = conT cls `appT` foldl apply (conT tyConName) (init tyVars)
++       apply t (PlainTV name _)    = appT t (varT name)
++       apply t (KindedTV name _ _) = appT t (varT name)
++#else
+    let (KindedTV tyVar (AppT (AppT ArrowT StarT) StarT)) = last tyVars
+        instanceType           = conT cls `appT` foldl apply (conT tyConName) (init tyVars)
+        apply t (PlainTV name)    = appT t (varT name)
+        apply t (KindedTV name _) = appT t (varT name)
++#endif
+  
+    putQ (Deriving tyConName tyVar)
+    return (instanceType, cs)



More information about the arch-commits mailing list