ersatz 0.4.2 → 0.4.3
raw patch · 4 files changed
+49/−28 lines, 4 filesdep ~containersPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: containers
API changes (from Hackage documentation)
- Ersatz.Internal.Formula: instance Data.Semigroup.Semigroup Ersatz.Internal.Formula.Clause
- Ersatz.Internal.Formula: instance Data.Semigroup.Semigroup Ersatz.Internal.Formula.Formula
+ Ersatz.Internal.Formula: instance GHC.Base.Semigroup Ersatz.Internal.Formula.Clause
+ Ersatz.Internal.Formula: instance GHC.Base.Semigroup Ersatz.Internal.Formula.Formula
- Ersatz.Solution: Solution :: (Literal -> Maybe Bool) -> (StableName () -> Maybe Bool) -> Solution
+ Ersatz.Solution: Solution :: Literal -> Maybe Bool -> StableName () -> Maybe Bool -> Solution
Files
- .travis.yml +29/−17
- CHANGELOG.md +5/−0
- ersatz.cabal +8/−4
- tests/Z001.hs +7/−7
.travis.yml view
@@ -1,6 +1,6 @@ # This Travis job script has been generated by a script via #-# runghc make_travis_yml_2.hs '-o' '.travis.yml' '--irc-channel=irc.freenode.org#haskell-lens' '--no-no-tests-no-bench' '--no-installed' 'cabal.project'+# runghc make_travis_yml_2.hs '-o' '.travis.yml' '--ghc-head' '--irc-channel=irc.freenode.org#haskell-lens' '--no-no-tests-no-bench' '--no-unconstrained' 'cabal.project' # # For more information, see https://github.com/hvr/multi-ghc-travis #@@ -44,25 +44,28 @@ matrix: include:- - compiler: "ghc-7.10.3"+ - compiler: "ghc-8.6.1"+ env: GHCHEAD=true+ addons: {apt: {packages: [*apt_packages,cabal-install-head,ghc-8.6.1], sources: [hvr-ghc]}}+ - compiler: "ghc-8.4.3" # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [*apt_packages,cabal-install-2.0,ghc-7.10.3], sources: [hvr-ghc]}}+ addons: {apt: {packages: [*apt_packages,cabal-install-2.2,ghc-8.4.3], sources: [hvr-ghc]}}+ - compiler: "ghc-8.2.2"+ # env: TEST=--disable-tests BENCH=--disable-benchmarks+ addons: {apt: {packages: [*apt_packages,cabal-install-2.2,ghc-8.2.2], sources: [hvr-ghc]}} - compiler: "ghc-8.0.2" # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [*apt_packages,cabal-install-2.0,ghc-8.0.2], sources: [hvr-ghc]}}- - compiler: "ghc-8.2.2"+ addons: {apt: {packages: [*apt_packages,cabal-install-2.2,ghc-8.0.2], sources: [hvr-ghc]}}+ - compiler: "ghc-7.10.3" # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [*apt_packages,cabal-install-2.0,ghc-8.2.2], sources: [hvr-ghc]}}- - compiler: "ghc-8.4.1"- env: GHCHEAD=true- addons: {apt: {packages: [*apt_packages,cabal-install-head,ghc-8.4.1], sources: [hvr-ghc]}}+ addons: {apt: {packages: [*apt_packages,cabal-install-2.2,ghc-7.10.3], sources: [hvr-ghc]}} - compiler: "ghc-head" env: GHCHEAD=true addons: {apt: {packages: [*apt_packages,cabal-install-head,ghc-head], sources: [hvr-ghc]}} allow_failures:- - compiler: "ghc-8.4.1" - compiler: "ghc-head"+ - compiler: "ghc-8.6.1" before_install: - HC=${CC}@@ -80,7 +83,8 @@ - BENCH=${BENCH---enable-benchmarks} - TEST=${TEST---enable-tests} - HADDOCK=${HADDOCK-true}- - INSTALLED=${INSTALLED-true}+ - UNCONSTRAINED=${UNCONSTRAINED-true}+ - NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false} - GHCHEAD=${GHCHEAD-false} - travis_retry cabal update -v - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"@@ -88,7 +92,8 @@ # Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage - | if $GHCHEAD; then- sed -i.bak 's/-- allow-newer:.*/allow-newer: *:base, *:template-haskell, *:ghc, *:Cabal/' ${HOME}/.cabal/config+ sed -i 's/-- allow-newer: .*/allow-newer: *:base/' ${HOME}/.cabal/config+ for pkg in $($HCPKG list --simple-output); do pkg=$(echo $pkg | sed 's/-[^-]*$//'); sed -i "s/allow-newer: /allow-newer: *:$pkg, /" ${HOME}/.cabal/config; done echo 'repository head.hackage' >> ${HOME}/.cabal/config echo ' url: http://head.hackage.haskell.org/' >> ${HOME}/.cabal/config@@ -98,17 +103,22 @@ echo ' 8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e' >> ${HOME}/.cabal/config echo ' key-threshold: 3' >> ${HOME}/.cabal.config + grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'+ cabal new-update head.hackage -v fi - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$' - "printf 'packages: \".\"\\n' > cabal.project"- - cat cabal.project+ - touch cabal.project.local+ - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"+ - cat cabal.project || true+ - cat cabal.project.local || true - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi - rm -f cabal.project.freeze - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all- - rm -rf "."/.ghc.environment.* "."/dist+ - rm -rf .ghc.environment.* "."/dist - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX) # Here starts the actual work to be performed for the package under test;@@ -120,8 +130,10 @@ - cd ${DISTDIR} || false - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \; - "printf 'packages: ersatz-*/*.cabal\\n' > cabal.project"- - cat cabal.project-+ - touch cabal.project.local+ - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"+ - cat cabal.project || true+ - cat cabal.project.local || true # build & run tests, build benchmarks - cabal new-build -w ${HC} ${TEST} ${BENCH} all@@ -134,5 +146,5 @@ - rm -rf ./dist-newstyle - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi -# REGENDATA ["-o",".travis.yml","--irc-channel=irc.freenode.org#haskell-lens","--no-no-tests-no-bench","--no-installed","cabal.project"]+# REGENDATA ["-o",".travis.yml","--ghc-head","--irc-channel=irc.freenode.org#haskell-lens","--no-no-tests-no-bench","--no-unconstrained","cabal.project"] # EOF
CHANGELOG.md view
@@ -1,3 +1,8 @@+0.4.3 [2018.07.03]+------------------+* Make the test suite compile on GHC 8.6.+* Allow building with `containers-0.6`.+ 0.4.2 ----- * Add `Semigroup` instances for `Clause` and `Formula`.
ersatz.cabal view
@@ -1,5 +1,5 @@ name: ersatz-version: 0.4.2+version: 0.4.3 license: BSD3 license-file: LICENSE author: Edward A. Kmett, Eric Mertens, Johan Kiviniemi@@ -75,7 +75,11 @@ build-type: Custom cabal-version: >= 1.10-tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1+tested-with: GHC == 7.10.3+ , GHC == 8.0.2+ , GHC == 8.2.2+ , GHC == 8.4.3+ , GHC == 8.6.1 extra-source-files: .ghci .gitignore@@ -178,13 +182,13 @@ array >= 0.2 && < 0.6, base >= 4.8 && < 5, bytestring >= 0.10.4.0 && < 0.12,- containers >= 0.2.0.1 && < 0.6,+ containers >= 0.2.0.1 && < 0.7, data-default >= 0.5 && < 0.8, lens >= 3.8 && < 5, mtl >= 1.1 && < 2.3, process >= 1.1 && < 1.7, semigroups >= 0.16 && < 1,- temporary >= 1.1 && < 1.3,+ temporary >= 1.1 && < 1.4, transformers >= 0.3 && < 0.6, unordered-containers == 0.2.*, attoparsec
tests/Z001.hs view
@@ -1,7 +1,7 @@ {-# language KindSignatures, DataKinds, FlexibleContexts #-} {-# language GeneralizedNewtypeDeriving #-} {-# language TypeFamilies, ScopedTypeVariables #-}-+{-# language UndecidableInstances #-} {-# language NoMonomorphismRestriction #-} import Prelude hiding ( not, and, or, (&&), (||) )@@ -36,7 +36,7 @@ row f = ( encode f : ) <$> replicateM (d-1) unknown m <- (:) <$> row 1 <*> replicateM (d-2) (row 0) return $ Restricted $ Matrix- $ m ++ encode [ replicate (d-1) 0 ++ [1] ] + $ m ++ encode [ replicate (d-1) 0 ++ [1] ] class Unknown a where unknown :: (MonadState s m, HasSAT s) => m a@@ -48,12 +48,12 @@ instance Codec a => Codec (Matrix dim a) where type Decoded (Matrix dim a) = Matrix dim (Decoded a) decode s (Matrix xss) = Matrix <$> decode s xss- + instance (KnownNat dim, Unknown a) => Unknown (Matrix dim a) where unknown = do let d = fromIntegral $ natVal (Proxy :: Proxy dim) Matrix <$> replicateM d (replicateM d unknown)- + instance Num a => Num (Matrix dim a) where Matrix xss + Matrix yss = Matrix $ zipWith (zipWith (+)) xss yss@@ -81,7 +81,7 @@ -- Bitvectors of fixed length, with non-overflowing arithmetics -- (if overflow occurs, constraint is unsatisfiable) -newtype NBV ( n :: Nat ) = NBV Bits +newtype NBV ( n :: Nat ) = NBV Bits deriving ( Show, Equatable, Orderable, HasBits ) instance KnownNat w => Unknown (NBV w) where@@ -91,10 +91,10 @@ positive (NBV (Bits bs)) = or bs -nbv n (Bits bs) = +nbv n (Bits bs) = let (p : re, post) = splitAt n bs in NBV $ Bits $ Run ( assert (not $ or post) *> return p )- : re + : re instance KnownNat n => Num (NBV n) where fromInteger = encode