dev-haskell/quickcheck-classes-base: fix USE="binary-laws -unary-laws" case

Reported-by: Toralf Förster
Closes: https://bugs.gentoo.org/804870
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
This commit is contained in:
Sergei Trofimovich 2021-07-30 23:30:08 +01:00
parent 1e49c6071e
commit c16eca8aec
No known key found for this signature in database
GPG Key ID: ED5E45E06F2AC293
4 changed files with 89 additions and 22 deletions

View File

@ -1 +1,2 @@
DIST quickcheck-classes-base-0.6.0.0.tar.gz 25760 BLAKE2B d09794c63da8311836e6422006d262fca21f7d71b473b69f57bd49b3ed2e39f29fcfd18b73fd311db4f6b1cca390cc579f2438481dbd680841c835d7d0d9f557 SHA512 3d0a7c68ab1cdaddbd272df633e0704f5ee3997b3a86fe79cb960f7c84f8546f3360b9d52ada45b9db6344135f0aab1093d5304935ae19f43d235790fba83216
DIST quickcheck-classes-base-0.6.2.0.tar.gz 26732 BLAKE2B aa3b7be411c66b72eb07c81e9fe2c1accdde254ae8e510080d7b0ea93df0148317a61633f96fe459ab329af112eee3d8243fb728f5416d95d258b90a40d1d9cf SHA512 730255f74582081e65fa8c6b36ab8a2c26991a8e7d8140361151614e7a9619f178e50820cdfc3bf5771f1688dce369f9d71de683bc89481a20f8d2382ae4b58d

View File

@ -0,0 +1,51 @@
From b59ab822c261283004c2e87cffc653dc2b35c030 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyfox@gentoo.org>
Date: Fri, 30 Jul 2021 23:23:19 +0100
Subject: [PATCH] quickcheck-classes-base: move qe1_q under UNARY_LAWS define
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In https://bugs.gentoo.org/804870 Toralf noticed a build failure:
```
$ cabal build --flags=binary-laws --flags=-unary-laws
Configuring quickcheck-classes-base-0.6.2.0...
Preprocessing library for quickcheck-classes-base-0.6.2.0..
Building library for quickcheck-classes-base-0.6.2.0..
[ 1 of 30] Compiling Test.QuickCheck.Classes.Internal ( src/Test/QuickCheck/Classes/Internal.hs, dist/build/Test/QuickCheck/Classes/Internal.o, dist/build/Test/QuickCheck/Classes/Internal.dyn_o )
src/Test/QuickCheck/Classes/Internal.hs:79:5: error:
Not in scope: eq1_2
|
79 | , eq1_2
| ^^^^^
```
In happens due to a mismatch between export and definition #ifdef guards.
The change fised declaration to match definition.
Reported-by: Toralf Förster
Bug: https://bugs.gentoo.org/804870
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
quickcheck-classes-base/src/Test/QuickCheck/Classes/Internal.hs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/src/Test/QuickCheck/Classes/Internal.hs
+++ b/src/Test/QuickCheck/Classes/Internal.hs
@@ -73,10 +73,10 @@ module Test.QuickCheck.Classes.Internal
, isTrue#
#if HAVE_UNARY_LAWS
, eq1
+ , eq1_2
#endif
#if HAVE_BINARY_LAWS
, eq2
- , eq1_2
#endif
, readMaybe
) where
--
2.32.0

View File

@ -6,28 +6,7 @@
<name>Gentoo Haskell</name>
</maintainer>
<use>
<flag name="binary-laws">Include infrastructure for testing class laws of binary type constructors. Disabling `unary-laws` while keeping `binary-laws` enabled is an unsupported configuration.</flag>
<flag name="unary-laws">Include infrastructure for testing class laws of unary type constructors.</flag>
<flag name="binary-laws">Include infrastructure for testing class laws of binary type constructors.
Disabling `unary-laws` while keeping `binary-laws` enabled is an unsupported
configuration.</flag>
</use>
<longdescription>
This libary is a minimal variant of `quickcheck-classes` that
only provides laws for typeclasses from `base`. The main purpose
of splitting this out is so that `primitive` can depend on
`quickcheck-classes-base` in its test suite, avoiding the circular
dependency that arises if `quickcheck-classes` is used instead.
This library provides QuickCheck properties to ensure
that typeclass instances adhere to the set of laws that
they are supposed to. There are other libraries that do
similar things, such as `genvalidity-hspec` and `checkers`.
This library differs from other solutions by not introducing
any new typeclasses that the user needs to learn.
/Note:/ on GHC &lt; 8.5, this library uses the higher-kinded typeclasses
('Data.Functor.Classes.Show1', 'Data.Functor.Classes.Eq1', 'Data.Functor.Classes.Ord1', etc.),
but on GHC &gt;= 8.5, it uses `-XQuantifiedConstraints` to express these
constraints more cleanly.
</longdescription>
</pkgmetadata>

View File

@ -0,0 +1,36 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# ebuild generated by hackport 0.6.7.9999
CABAL_FEATURES="lib profile haddock hoogle hscolour"
inherit haskell-cabal
DESCRIPTION="QuickCheck common typeclasses from 'base'"
HOMEPAGE="https://github.com/andrewthad/quickcheck-classes#readme"
SRC_URI="https://hackage.haskell.org/package/${P}/${P}.tar.gz"
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86"
IUSE="+binary-laws +unary-laws"
RDEPEND="dev-haskell/contravariant:=[profile?]
>=dev-lang/ghc-8.4.3:=
binary-laws? ( >=dev-haskell/quickcheck-2.10.0:2=[profile?] )
unary-laws? ( >=dev-haskell/quickcheck-2.10.0:2=[profile?] )
!unary-laws? ( !binary-laws? ( >=dev-haskell/quickcheck-2.7:2=[profile?] ) )
"
DEPEND="${RDEPEND}
>=dev-haskell/cabal-2.4
"
PATCHES=("${FILESDIR}"/${P}-laws.patch)
src_configure() {
haskell-cabal_src_configure \
$(cabal_flag binary-laws binary-laws) \
$(cabal_flag unary-laws unary-laws)
}