[arch-commits] Commit in haskell-what4/repos (3 files)

Felix Yan felixonmars at gemini.archlinux.org
Fri May 13 11:21:20 UTC 2022


    Date: Friday, May 13, 2022 @ 11:21:20
  Author: felixonmars
Revision: 1201731

archrelease: copy trunk to community-staging-x86_64

Added:
  haskell-what4/repos/community-staging-x86_64/
  haskell-what4/repos/community-staging-x86_64/PKGBUILD
    (from rev 1201730, haskell-what4/trunk/PKGBUILD)
  haskell-what4/repos/community-staging-x86_64/hashable-1.4.patch
    (from rev 1201730, haskell-what4/trunk/hashable-1.4.patch)

--------------------+
 PKGBUILD           |   62 +++++++++++
 hashable-1.4.patch |  266 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 328 insertions(+)

Copied: haskell-what4/repos/community-staging-x86_64/PKGBUILD (from rev 1201730, haskell-what4/trunk/PKGBUILD)
===================================================================
--- community-staging-x86_64/PKGBUILD	                        (rev 0)
+++ community-staging-x86_64/PKGBUILD	2022-05-13 11:21:20 UTC (rev 1201731)
@@ -0,0 +1,62 @@
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+
+_hkgname=what4
+pkgname=haskell-what4
+pkgver=1.2.1
+pkgrel=126
+pkgdesc="Solver-agnostic symbolic values support for issuing queries"
+url="https://github.com/GaloisInc/what4"
+license=('BSD')
+arch=('x86_64')
+depends=('ghc-libs' 'haskell-attoparsec' 'haskell-bimap' 'haskell-bifunctors' 'haskell-bv-sized'
+         'haskell-config-value' 'haskell-deriving-compat' 'haskell-data-binary-ieee754'
+         'haskell-extra' 'haskell-fingertree' 'haskell-hashable' 'haskell-hashtables'
+         'haskell-io-streams' 'haskell-lens' 'haskell-libbf' 'haskell-panic'
+         'haskell-parameterized-utils' 'haskell-prettyprinter' 'haskell-scientific'
+         'haskell-temporary' 'haskell-th-abstraction' 'haskell-th-lift' 'haskell-th-lift-instances'
+         'haskell-unordered-containers' 'haskell-utf8-string' 'haskell-vector' 'haskell-versions'
+         'haskell-zenc')
+makedepends=('ghc' 'uusi' 'haskell-contravariant' 'haskell-hedgehog' 'haskell-lumberjack'
+             'haskell-quickcheck' 'haskell-tasty' 'haskell-tasty-checklist'
+             'haskell-tasty-hedgehog' 'haskell-tasty-hunit' 'haskell-tasty-quickcheck'
+             'haskell-tasty-sugar')
+checkdepends=('cvc4' 'yices' 'z3')
+optdepends=('cvc4' 'yices' 'z3')
+source=(https://hackage.haskell.org/packages/archive/${_hkgname}/${pkgver}/${_hkgname}-${pkgver}.tar.gz
+        hashable-1.4.patch)
+sha512sums=('494e030c0302997205bf4ac3cbd877cd107b22cc3dcb1ca64a075434f95c0a993a82ac27ad5098e616a2f72f8cb9d6234d41a2c5e0335eb874953963281d1318'
+            '2f048d498c9edc7f51a95759bc2ff9099339ec7df37ad1b7ec5cebf4e24b538ce76bef802620e92ae84887712eaf05e5d601c919464381544a92ce24cd8ce2fc')
+
+prepare() {
+    cd $_hkgname-$pkgver
+    patch -p2 -i ../hashable-1.4.patch
+    gen-setup
+}
+
+build() {
+    cd $_hkgname-$pkgver
+    
+    runhaskell Setup configure -O --enable-shared --enable-executable-dynamic --disable-library-vanilla \
+        --prefix=/usr --docdir=/usr/share/doc/$pkgname --datasubdir=$pkgname --enable-tests \
+        --dynlibdir=/usr/lib --libsubdir=\$compiler/site-local/\$pkgid --ghc-option=-fllvm
+    runhaskell Setup build $MAKEFLAGS
+    runhaskell Setup register --gen-script
+    runhaskell Setup unregister --gen-script
+    sed -i -r -e "s|ghc-pkg.*update[^ ]* |&'--force' |" register.sh
+    sed -i -r -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" unregister.sh
+}
+
+check() {
+    cd $_hkgname-$pkgver
+    runhaskell Setup test --show-details=direct
+}
+
+package() {
+    cd $_hkgname-$pkgver
+    
+    install -D -m744 register.sh "$pkgdir"/usr/share/haskell/register/$pkgname.sh
+    install -D -m744 unregister.sh "$pkgdir"/usr/share/haskell/unregister/$pkgname.sh
+    runhaskell Setup copy --destdir="$pkgdir"
+    install -D -m644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+    rm -f "$pkgdir"/usr/share/doc/$pkgname/LICENSE
+}

Copied: haskell-what4/repos/community-staging-x86_64/hashable-1.4.patch (from rev 1201730, haskell-what4/trunk/hashable-1.4.patch)
===================================================================
--- community-staging-x86_64/hashable-1.4.patch	                        (rev 0)
+++ community-staging-x86_64/hashable-1.4.patch	2022-05-13 11:21:20 UTC (rev 1201731)
@@ -0,0 +1,266 @@
+From 3db89da15cc36a4e7be8860d630261a63e62bea1 Mon Sep 17 00:00:00 2001
+From: Ryan Scott <rscott at galois.com>
+Date: Wed, 5 Jan 2022 10:54:14 -0600
+Subject: [PATCH] Allow building with hashable-1.4.*
+
+This was prompted by GaloisInc/parameterized-utils#126, but the changes needed
+on `what4`'s end can be applied independently.
+---
+ what4/CHANGES.md                            | 11 +++++++++++
+ what4/src/What4/BaseTypes.hs                |  6 ++++++
+ what4/src/What4/Expr/App.hs                 |  5 ++++-
+ what4/src/What4/Expr/ArrayUpdateMap.hs      |  2 +-
+ what4/src/What4/Expr/BoolMap.hs             |  2 +-
+ what4/src/What4/Expr/MATLAB.hs              |  4 ++++
+ what4/src/What4/Expr/StringSeq.hs           |  2 +-
+ what4/src/What4/Expr/UnaryBV.hs             |  2 ++
+ what4/src/What4/Expr/WeightedSum.hs         |  8 +++++++-
+ what4/src/What4/Interface.hs                |  2 +-
+ what4/src/What4/InterpretedFloatingPoint.hs |  2 ++
+ what4/src/What4/SemiRing.hs                 |  6 ++++++
+ what4/src/What4/SpecialFunctions.hs         |  5 ++++-
+ what4/src/What4/Utils/OnlyIntRepr.hs        |  3 +++
+ 14 files changed, 53 insertions(+), 7 deletions(-)
+
+diff --git a/what4/CHANGES.md b/what4/CHANGES.md
+index 434bc5bc..dea6e828 100644
+--- a/what4/CHANGES.md
++++ b/what4/CHANGES.md
+@@ -1,3 +1,14 @@
++# next (TBA)
++
++* Allow building with `hashable-1.4.*`:
++  * Add `Eq` instances for all data types with `Hashable` instances that
++    were missing corresponding `Eq` instances. This is required since
++    `hashable-1.4.0.0` adds an `Eq` superclass to `Hashable`.
++  * Some `Hashable` instances now have extra constraints to match the
++    constraints in their corresponding `Eq` instances. For example,
++    the `Hashable` instance for `SymNat` now has an extra `TestEquality`
++    constraint to match its `Eq` instance.
++
+ # 1.2.1 (June 2021)
+ 
+ * Include test suite data in the Hackage tarball.
+diff --git a/what4/src/What4/BaseTypes.hs b/what4/src/What4/BaseTypes.hs
+index 8040e05a..73aaef41 100644
+--- a/what4/src/What4/BaseTypes.hs
++++ b/what4/src/What4/BaseTypes.hs
+@@ -311,6 +311,8 @@ instance TestEquality BaseTypeRepr where
+                      )
+                    ]
+                   )
++instance Eq (BaseTypeRepr bt) where
++  x == y = isJust (testEquality x y)
+ 
+ instance OrdF BaseTypeRepr where
+   compareF = $(structuralTypeOrd [t|BaseTypeRepr|]
+@@ -328,6 +330,8 @@ instance TestEquality FloatPrecisionRepr where
+   testEquality = $(structuralTypeEquality [t|FloatPrecisionRepr|]
+       [(TypeApp (ConType [t|NatRepr|]) AnyType, [|testEquality|])]
+     )
++instance Eq (FloatPrecisionRepr fpp) where
++  x == y = isJust (testEquality x y)
+ instance OrdF FloatPrecisionRepr where
+   compareF = $(structuralTypeOrd [t|FloatPrecisionRepr|]
+       [(TypeApp (ConType [t|NatRepr|]) AnyType, [|compareF|])]
+@@ -335,5 +339,7 @@ instance OrdF FloatPrecisionRepr where
+ 
+ instance TestEquality StringInfoRepr where
+   testEquality = $(structuralTypeEquality [t|StringInfoRepr|] [])
++instance Eq (StringInfoRepr si) where
++  x == y = isJust (testEquality x y)
+ instance OrdF StringInfoRepr where
+   compareF = $(structuralTypeOrd [t|StringInfoRepr|] [])
+diff --git a/what4/src/What4/Expr/App.hs b/what4/src/What4/Expr/App.hs
+index 66c644e4..28180902 100644
+--- a/what4/src/What4/Expr/App.hs
++++ b/what4/src/What4/Expr/App.hs
+@@ -937,7 +937,7 @@ instance TestEquality e => TestEquality (NonceApp t e) where
+            ]
+           )
+ 
+-instance HashableF e => HashableF (NonceApp t e) where
++instance (HashableF e, TestEquality e) => HashableF (NonceApp t e) where
+   hashWithSaltF = $(structuralHashWithSalt [t|NonceApp|]
+                       [ (DataArg 1 `TypeApp` AnyType, [|hashWithSaltF|]) ])
+ 
+@@ -1698,6 +1698,9 @@ asMatlabSolverFn f
+   | otherwise = Nothing
+ 
+ 
++instance Eq (ExprSymFn t args tp) where
++  x == y = isJust (testExprSymFnEq x y)
++
+ instance Hashable (ExprSymFn t args tp) where
+   hashWithSalt s f = s `hashWithSalt` symFnId f
+ 
+diff --git a/what4/src/What4/Expr/ArrayUpdateMap.hs b/what4/src/What4/Expr/ArrayUpdateMap.hs
+index 9819ceea..37deec8f 100644
+--- a/what4/src/What4/Expr/ArrayUpdateMap.hs
++++ b/what4/src/What4/Expr/ArrayUpdateMap.hs
+@@ -65,7 +65,7 @@ newtype ArrayUpdateMap e ctx tp =
+ instance TestEquality e => Eq (ArrayUpdateMap e ctx tp) where
+   ArrayUpdateMap m1 == ArrayUpdateMap m2 = AM.eqBy (\ x y -> isJust $ testEquality x y) m1 m2
+ 
+-instance Hashable (ArrayUpdateMap e ctx tp) where
++instance TestEquality e => Hashable (ArrayUpdateMap e ctx tp) where
+   hashWithSalt s (ArrayUpdateMap m) =
+     case AM.annotation m of
+       Nothing  -> hashWithSalt s (111::Int)
+diff --git a/what4/src/What4/Expr/BoolMap.hs b/what4/src/What4/Expr/BoolMap.hs
+index 334c8f1b..9c85303c 100644
+--- a/what4/src/What4/Expr/BoolMap.hs
++++ b/what4/src/What4/Expr/BoolMap.hs
+@@ -63,7 +63,7 @@ instance TestEquality f => Eq (Wrap f x) where
+   Wrap a == Wrap b = isJust $ testEquality a b
+ instance OrdF f => Ord (Wrap f x) where
+   compare (Wrap a) (Wrap b) = toOrdering $ compareF a b
+-instance HashableF f => Hashable (Wrap f x) where
++instance (HashableF f, TestEquality f) => Hashable (Wrap f x) where
+   hashWithSalt s (Wrap a) = hashWithSaltF s a
+ 
+ -- | This data structure keeps track of a collection of expressions
+diff --git a/what4/src/What4/Expr/MATLAB.hs b/what4/src/What4/Expr/MATLAB.hs
+index 25f4d8d5..586462f2 100644
+--- a/what4/src/What4/Expr/MATLAB.hs
++++ b/what4/src/What4/Expr/MATLAB.hs
+@@ -731,9 +731,13 @@ testSolverFnEq = $(structuralTypeEquality [t|MatlabSolverFn|]
+                    ]
+                   )
+ 
++instance TestEquality f => Eq (MatlabSolverFn f args tp) where
++  x == y = isJust (testSolverFnEq x y)
++
+ instance ( Hashable (f BaseRealType)
+          , Hashable (f BaseIntegerType)
+          , HashableF f
++         , TestEquality f
+          )
+          => Hashable (MatlabSolverFn f args tp) where
+   hashWithSalt = $(structuralHashWithSalt [t|MatlabSolverFn|] [])
+diff --git a/what4/src/What4/Expr/StringSeq.hs b/what4/src/What4/Expr/StringSeq.hs
+index 1c160158..d94aace7 100644
+--- a/what4/src/What4/Expr/StringSeq.hs
++++ b/what4/src/What4/Expr/StringSeq.hs
+@@ -106,7 +106,7 @@ instance (TestEquality e, HasAbsValue e, HashableF e) => Eq (StringSeq e si) whe
+ instance (HasAbsValue e, HashableF e) => HashableF (StringSeq e) where
+   hashWithSaltF s (StringSeq _si xs) = hashWithSalt s (sft_hash xs)
+ 
+-instance (HasAbsValue e, HashableF e) => Hashable (StringSeq e si) where
++instance (HasAbsValue e, HashableF e, TestEquality e) => Hashable (StringSeq e si) where
+   hashWithSalt = hashWithSaltF
+ 
+ singleton :: (HasAbsValue e, HashableF e, IsExpr e) => StringInfoRepr si -> e (BaseStringType si) -> StringSeq e si
+diff --git a/what4/src/What4/Expr/UnaryBV.hs b/what4/src/What4/Expr/UnaryBV.hs
+index a36964a6..5893517b 100644
+--- a/what4/src/What4/Expr/UnaryBV.hs
++++ b/what4/src/What4/Expr/UnaryBV.hs
+@@ -135,6 +135,8 @@ instance Eq p => TestEquality (UnaryBV p) where
+       Just Refl
+     else
+       Nothing
++instance Eq p => Eq (UnaryBV p n) where
++  x == y = isJust (testEquality x y)
+ 
+ instance Hashable p => Hashable (UnaryBV p n) where
+   hashWithSalt s0 u = Map.foldlWithKey' go s0 (unaryBVMap u)
+diff --git a/what4/src/What4/Expr/WeightedSum.hs b/what4/src/What4/Expr/WeightedSum.hs
+index 87e37f09..043352e9 100644
+--- a/what4/src/What4/Expr/WeightedSum.hs
++++ b/what4/src/What4/Expr/WeightedSum.hs
+@@ -166,7 +166,7 @@ instance OrdF f => Ord (WrapF f i) where
+ instance TestEquality f => Eq (WrapF f i) where
+   (WrapF x) == (WrapF y) = isJust $ testEquality x y
+ 
+-instance HashableF f => Hashable (WrapF f i) where
++instance (HashableF f, TestEquality f) => Hashable (WrapF f i) where
+   hashWithSalt s (WrapF x) = hashWithSaltF s x
+ 
+ traverseWrap :: Functor m => (f (SR.SemiRingBase i) -> m (g (SR.SemiRingBase i))) -> WrapF f i -> m (WrapF g i)
+@@ -303,6 +303,9 @@ instance OrdF f => TestEquality (SemiRingProduct f) where
+            unless (AM.eqBy (SR.occ_eq (prodRepr x)) (_prodMap x) (_prodMap y)) Nothing
+            return Refl
+ 
++instance OrdF f => Eq (SemiRingProduct f sr) where
++  x == y = isJust (testEquality x y)
++
+ instance OrdF f => TestEquality (WeightedSum f) where
+   testEquality x y
+     | sumMapHash x /= sumMapHash y = Nothing
+@@ -312,6 +315,9 @@ instance OrdF f => TestEquality (WeightedSum f) where
+             unless (AM.eqBy (SR.eq (sumRepr x)) (_sumMap x) (_sumMap y)) Nothing
+             return Refl
+ 
++instance OrdF f => Eq (WeightedSum f sr) where
++  x == y = isJust (testEquality x y)
++
+ 
+ -- | Created a weighted sum directly from a map and constant.
+ --
+diff --git a/what4/src/What4/Interface.hs b/what4/src/What4/Interface.hs
+index 167dbc54..0d56ffb0 100644
+--- a/what4/src/What4/Interface.hs
++++ b/what4/src/What4/Interface.hs
+@@ -543,7 +543,7 @@ instance TestEquality (SymExpr sym) => Eq (SymNat sym) where
+ instance OrdF (SymExpr sym) => Ord (SymNat sym) where
+   compare (SymNat x) (SymNat y) = toOrdering (compareF x y)
+ 
+-instance HashableF (SymExpr sym) => Hashable (SymNat sym) where
++instance (HashableF (SymExpr sym), TestEquality (SymExpr sym)) => Hashable (SymNat sym) where
+   hashWithSalt s (SymNat x) = hashWithSaltF s x
+ 
+ ------------------------------------------------------------------------
+diff --git a/what4/src/What4/InterpretedFloatingPoint.hs b/what4/src/What4/InterpretedFloatingPoint.hs
+index 09c2d77c..5d52153c 100644
+--- a/what4/src/What4/InterpretedFloatingPoint.hs
++++ b/what4/src/What4/InterpretedFloatingPoint.hs
+@@ -107,6 +107,8 @@ instance ShowF FloatInfoRepr
+ 
+ instance TestEquality FloatInfoRepr where
+   testEquality = $(structuralTypeEquality [t|FloatInfoRepr|] [])
++instance Eq (FloatInfoRepr fi) where
++  x == y = isJust (testEquality x y)
+ instance OrdF FloatInfoRepr where
+   compareF = $(structuralTypeOrd [t|FloatInfoRepr|] [])
+ 
+diff --git a/what4/src/What4/SemiRing.hs b/what4/src/What4/SemiRing.hs
+index 6e1f9bf8..38a1e728 100644
+--- a/what4/src/What4/SemiRing.hs
++++ b/what4/src/What4/SemiRing.hs
+@@ -233,9 +233,13 @@ $(return [])
+ 
+ instance TestEquality BVFlavorRepr where
+   testEquality = $(structuralTypeEquality [t|BVFlavorRepr|] [])
++instance Eq (BVFlavorRepr fv) where
++  x == y = isJust (testEquality x y)
+ 
+ instance TestEquality OrderedSemiRingRepr where
+   testEquality = $(structuralTypeEquality [t|OrderedSemiRingRepr|] [])
++instance Eq (OrderedSemiRingRepr sr) where
++  x == y = isJust (testEquality x y)
+ 
+ instance TestEquality SemiRingRepr where
+   testEquality =
+@@ -243,6 +247,8 @@ instance TestEquality SemiRingRepr where
+       [ (ConType [t|NatRepr|] `TypeApp` AnyType, [|testEquality|])
+       , (ConType [t|BVFlavorRepr|] `TypeApp` AnyType, [|testEquality|])
+       ])
++instance Eq (SemiRingRepr sr) where
++  x == y = isJust (testEquality x y)
+ 
+ instance OrdF BVFlavorRepr where
+   compareF = $(structuralTypeOrd [t|BVFlavorRepr|] [])
+diff --git a/what4/src/What4/Utils/OnlyIntRepr.hs b/what4/src/What4/Utils/OnlyIntRepr.hs
+index b65d0134..e995bd63 100644
+--- a/what4/src/What4/Utils/OnlyIntRepr.hs
++++ b/what4/src/What4/Utils/OnlyIntRepr.hs
+@@ -25,6 +25,9 @@ data OnlyIntRepr tp
+ instance TestEquality OnlyIntRepr where
+   testEquality OnlyIntRepr OnlyIntRepr = Just Refl
+ 
++instance Eq (OnlyIntRepr tp) where
++  OnlyIntRepr == OnlyIntRepr = True
++
+ instance Hashable (OnlyIntRepr tp) where
+   hashWithSalt s OnlyIntRepr = s
+ 



More information about the arch-commits mailing list