speculate 0.4.14 → 0.4.16
raw patch · 12 files changed
+163/−106 lines, 12 filesdep ~leancheckPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: leancheck
API changes (from Hackage documentation)
- Test.Speculate: class Name a
+ Test.Speculate: class () => Name a
- Test.Speculate: data Expr
+ Test.Speculate: data () => Expr
Files
- .github/workflows/build.yml +35/−28
- Makefile +3/−3
- README.md +2/−2
- bench/runtime-zero +33/−36
- changelog.md +20/−10
- mk/depend.mk +33/−0
- mk/haskell.mk +6/−3
- speculate.cabal +6/−9
- src/Test/Speculate/Reason.hs +2/−0
- stack.yaml +3/−3
- test/expr.hs +14/−10
- test/sdist +6/−2
.github/workflows/build.yml view
@@ -1,8 +1,10 @@ # Builds and tests this Haskell project on "GitHub Actions" #-# 2021 Rudy Matela+# 2021-2023 Rudy Matela # # some docs: https://github.com/haskell/actions/tree/main/setup+#+# The official haskell docker image: https://hub.docker.com/_/haskell name: build on: [push] jobs:@@ -11,24 +13,26 @@ steps: - name: Cache ~/.cabal/packages- uses: actions/cache@v2+ uses: actions/cache@v3 with: path: ~/.cabal/packages- key: v1-${{ runner.os }}-cabal-packages-${{ hashFiles('hello.cabal') }}+ key: v1-${{ runner.os }}-cabal-packages-${{ hashFiles('*.cabal') }} restore-keys: v1-${{ runner.os }}-cabal-packages- - name: Cache ~/.cabal and ~/.ghc- uses: actions/cache@v2+ uses: actions/cache@v3 with: path: | ~/.cabal !~/.cabal/packages ~/.ghc- key: v1-${{ runner.os }}-cabal-ghc-latest-${{ hashFiles('hello.cabal') }}+ key: v1-${{ runner.os }}-cabal-ghc-latest-${{ hashFiles('*.cabal') }} restore-keys: v1-${{ runner.os }}-cabal-ghc-latest- - run: du -hd3 ~/.cabal ~/.ghc || true + - run: make --version+ - run: haddock --version || sudo apt-get install ghc-haddock - run: ghc --version - run: cabal --version@@ -36,50 +40,54 @@ - run: ghc-pkg list - name: Check out repository- uses: actions/checkout@v2+ uses: actions/checkout@v3 - - run: cabal update+ - run: git --version+ - run: make install-dependencies - - run: make- - run: make test- - run: make haddock+ # 2023-07: some projects were failing with missing base for GHC 9.6.+ # Here we compile through cabal only provisionally.+ # - run: make+ # - run: make test+ # - run: make haddock - run: make test-sdist- - run: make test-via-cabal+ #- run: make test-via-cabal+ - run: cabal configure --enable-tests --enable-benchmarks --ghc-options="-O0"+ - run: cabal build+ - run: cabal test+ - run: cabal haddock test-with-ghc: strategy: matrix: ghc:+ - '9.4'+ - '9.2' - '9.0' - '8.10'- - '8.8' - '8.6'- - '8.4' - '8.2'- - '8.0'- - '7.10'- - '7.8' runs-on: ubuntu-latest needs: build-and-test container: haskell:${{ matrix.ghc }} steps: - name: Cache ~/.cabal/packages- uses: actions/cache@v2+ uses: actions/cache@v3 with: path: ~/.cabal/packages- key: v1-${{ runner.os }}-cabal-packages-${{ hashFiles('hello.cabal') }}+ key: v1-${{ runner.os }}-cabal-packages-${{ hashFiles('*.cabal') }} restore-keys: v1-${{ runner.os }}-cabal-packages- - name: Cache ~/.cabal and ~/.ghc- uses: actions/cache@v2+ uses: actions/cache@v3 with: path: | ~/.cabal !~/.cabal/packages ~/.ghc- key: v1-${{ runner.os }}-cabal-ghc-${{ matrix.ghc }}-${{ hashFiles('hello.cabal') }}+ key: v1-${{ runner.os }}-cabal-ghc-${{ matrix.ghc }}-${{ hashFiles('*.cabal') }} restore-keys: v1-${{ runner.os }}-cabal-ghc-${{ matrix.ghc }}- - run: du -hd3 ~/.cabal ~/.ghc || true@@ -94,9 +102,8 @@ - run: ghc-pkg list - name: Check out repository- uses: actions/checkout@v2+ uses: actions/checkout@v3 - - run: cabal update - run: make install-dependencies - run: make@@ -110,12 +117,12 @@ needs: build-and-test steps: - name: Setup Haskell's GHC and Cabal as required by current Stackage LTS- uses: haskell/actions/setup@v1- with: # lts-17.9- ghc-version: '8.10.4'- cabal-version: '3.2'+ uses: haskell/actions/setup@v2+ with: # lts-19.19+ ghc-version: '9.0.2'+ cabal-version: '3.4' - - uses: actions/cache@v2+ - uses: actions/cache@v3 with: path: ~/.stack key: v1-${{ runner.os }}-stack-${{ hashFiles('stack.yaml') }}@@ -124,5 +131,5 @@ - run: stack --version - name: Check out repository- uses: actions/checkout@v2+ uses: actions/checkout@v3 - run: make test-via-stack
Makefile view
@@ -4,8 +4,8 @@ # License: 3-Clause BSD (see the file LICENSE) # Maintainer: Rudy Matela <rudy@matela.com.br> GHCIMPORTDIRS = src:eg:test-GHCFLAGS = -O2 \- $(shell grep -q "Arch Linux" /etc/lsb-release && echo -dynamic)+GHCFLAGS = -O2 -v0 \+ $(shell grep -q "Arch Linux" /etc/lsb-release && echo -dynamic -package cmdargs -package regex-tdfa) # -Wall -Wno-name-shadowing -Wno-orphans -Wno-unused-matches # -prof -auto-all #-caf-all # When profiling is enabled, to get the cost centres with more than 6% time:@@ -42,7 +42,6 @@ eg/string \ eg/oddeven \ eg/plus-abs \- eg/pretty \ eg/ratio \ eg/sets \ eg/tauts \@@ -55,6 +54,7 @@ bench/trilean \ bench/unit EXTRAEG = \+ eg/pretty \ eg/regexes \ eg/pretty-compact \ eg/algebraic-graphs
README.md view
@@ -222,7 +222,7 @@ For more examples, see the [eg](eg) and [bench](bench) folders. Speculate has been subject to a paper, see the-[Speculate Paper on Haskell Symposium 2017](https://matela.com.br/paper/speculate.pdf).+[Speculate Paper on Haskell Symposium 2017](https://matela.com.br/speculate.pdf). Speculate is also subject to a chapter in a [PhD Thesis (2017)]. [leancheck]: https://hackage.haskell.org/package/leancheck@@ -235,7 +235,7 @@ [Cabal]: https://www.haskell.org/cabal [Haskell]: https://www.haskell.org/ -[PhD Thesis (2017)]: https://matela.com.br/paper/rudy-phd-thesis-2017.pdf+[PhD Thesis (2017)]: https://matela.com.br/thesis-rudy.pdf [`speculate`]: https://hackage.haskell.org/package/speculate/docs/Test-Speculate.html#v:speculate [`constant`]: https://hackage.haskell.org/package/speculate/docs/Test-Speculate.html#v:constant
bench/runtime-zero view
@@ -1,36 +1,33 @@-GHC 8.10.4-express-1.0.6-leancheck-0.9.10-arith 0.233-arith-c 0.570-arithficial 0.606-arith-negate-abs 1.656-binarytree 1.630-binarytree0 0.513-bool 2.043-bool-c 1.806-colour 2.003-digraphs 1.486-fun 1.100-insertsort 7.676-insertsort0 0.896-length 0.463-list 2.530-list-c 1.580-lowtests 0.436-minus 0.513-minus-c 0.880-monad 0.566-nord 0.010-oddeven 6.506-plus-abs 3.510-pretty 8.743-ratio 8.030-sets 7.193-speculate-reason 2.770-string 0.850-tauts 3.980-trilean 0.010-tuples 1.210-unit 0.010-zip 2.283+GHC 9.0.2+arith 0.290+arith-c 0.613+arithficial 0.690+arith-negate-abs 1.773+binarytree 1.813+binarytree0 0.606+bool 2.073+bool-c 1.886+colour 2.186+digraphs 1.663+fun 1.120+insertsort 7.763+insertsort0 0.943+length 0.496+list 2.580+list-c 1.586+lowtests 0.493+minus 0.553+minus-c 0.926+monad 0.596+nord 0.040+oddeven 7.486+plus-abs 3.693+ratio 8.343+sets 7.640+speculate-reason 3.363+string 0.993+tauts 4.790+trilean 0.050+tuples 1.383+unit 0.040+zip 2.596
changelog.md view
@@ -2,32 +2,42 @@ ======================= -v0.4.14--------+v0.4.16 (February 2024)+----------------------- +* no changes in API+* fix compatibility with [express] >= v1.0.16+* bump [LeanCheck] requirement to >= 1.0.0+* improve tests of Speculate itself+* add release dates on this changelog+++v0.4.14 (September 2021)+------------------------+ * `Test.Speculate.Reason`: add `doubleCheck`; * add `lowtests` benchmark; * bump [express] requirement to v1.0.0; * fix parallel compilation when using the Makefile. -v0.4.12--------+v0.4.12 (July 2021)+------------------- * bump [express] requirement to v0.2.0 * add this changelog -v0.4.10--------+v0.4.10 (June 2021)+------------------- * no changes in the actual [Speculate] library * cleanup build files * remove uneeded typeable derivations on examples and tests -v0.4.8-------+v0.4.8 (June 2021)+------------------ * no changes in the actual [Speculate] library * refactor build scripts@@ -35,8 +45,8 @@ * fix compilation of some examples under the new [LeanCheck] -v0.4.6-------+v0.4.6 (April 2021)+------------------- * [`Test.Speculate`]: export `reifyName`; * "internal" modules:
mk/depend.mk view
@@ -31,6 +31,39 @@ src/Test/Speculate/CondReason.hs \ src/Test/Speculate/Args.hs \ bench/arithficial.hs+bench/lowtests: \+ bench/lowtests.hs \+ mk/toplibs+bench/lowtests.o: \+ src/Test/Speculate/Utils/Tuple.hs \+ src/Test/Speculate/Utils/Timeout.hs \+ src/Test/Speculate/Utils/Tiers.hs \+ src/Test/Speculate/Utils/String.hs \+ src/Test/Speculate/Utils/PrettyPrint.hs \+ src/Test/Speculate/Utils.hs \+ src/Test/Speculate/Utils/Ord.hs \+ src/Test/Speculate/Utils/Misc.hs \+ src/Test/Speculate/Utils/Memoize.hs \+ src/Test/Speculate/Utils/List.hs \+ src/Test/Speculate/Utils/Digraph.hs \+ src/Test/Speculate/Utils/Colour.hs \+ src/Test/Speculate/Utils/Class.hs \+ src/Test/Speculate/SemiReason.hs \+ src/Test/Speculate/Sanity.hs \+ src/Test/Speculate/Report.hs \+ src/Test/Speculate/Reason.hs \+ src/Test/Speculate/Reason/Order.hs \+ src/Test/Speculate/Pretty.hs \+ src/Test/Speculate.hs \+ src/Test/Speculate/Expr.hs \+ src/Test/Speculate/Expr/Instance.hs \+ src/Test/Speculate/Expr/Ground.hs \+ src/Test/Speculate/Expr/Equate.hs \+ src/Test/Speculate/Expr/Core.hs \+ src/Test/Speculate/Engine.hs \+ src/Test/Speculate/CondReason.hs \+ src/Test/Speculate/Args.hs \+ bench/lowtests.hs bench/nord: \ bench/nord.hs \ mk/toplibs
mk/haskell.mk view
@@ -1,6 +1,6 @@ # Implicit rules for compiling Haskell code. #-# Copyright (c) 2015-2021 Rudy Matela.+# Copyright (c) 2015-2023 Rudy Matela. # Distributed under the 3-Clause BSD licence. # # You can optionally configure the "Configuration variables" below in your main@@ -21,7 +21,7 @@ GHC ?= ghc GHCCMD = $(GHC) -i$(GHCIMPORTDIRS) $(GHCFLAGS) HADDOCK ?= haddock-CABAL_INSTALL = $(shell cabal --version | grep -q "version [0-2]\." && echo 'cabal install' || echo 'cabal v1-install')+CABAL_INSTALL = $(shell cabal --version | grep -q "version [0-2]\." && echo 'cabal install' || echo 'cabal install --lib') # Hugs Parameters HUGSIMPORTDIRS ?= "/usr/lib/hugs/packages/*"@@ -90,7 +90,10 @@ find $(ALL_HSS) | ./mk/ghcdeps -i$(GHCIMPORTDIRS) $(GHCFLAGS) > $(DEPMK) install-dependencies:- $(CABAL_INSTALL) $(INSTALL_DEPS)+ if [ -n "$(INSTALL_DEPS)" ]; then \+ cabal update && \+ $(CABAL_INSTALL) $(INSTALL_DEPS); \+ fi # haddock rules haddock: doc/index.html
speculate.cabal view
@@ -1,5 +1,5 @@ name: speculate-version: 0.4.14+version: 0.4.16 synopsis: discovery of properties about Haskell functions description: Speculate automatically discovers laws about Haskell functions.@@ -70,15 +70,12 @@ , test/update-diff , test/sdist -tested-with: GHC==9.0+tested-with: GHC==9.4+ , GHC==9.2+ , GHC==9.0 , GHC==8.10- , GHC==8.8 , GHC==8.6- , GHC==8.4 , GHC==8.2- , GHC==8.0- , GHC==7.10- , GHC==7.8 source-repository head type: git@@ -87,7 +84,7 @@ source-repository this type: git location: https://github.com/rudymatela/speculate- tag: v0.4.14+ tag: v0.4.16 library@@ -123,7 +120,7 @@ , Test.Speculate.Utils.Timeout , Test.Speculate.Utils.Tuple build-depends: base >= 4 && < 5- , leancheck >= 0.9.6+ , leancheck >= 1.0.0 , express >= 1.0.0 , cmdargs , containers
src/Test/Speculate/Reason.hs view
@@ -413,9 +413,11 @@ _ -> error $ "canonicalizeRuleWith: the impossible happened," ++ "this is definitely a bug, see source!" +-- | Prints a 'Thy' (theory) on the console. (cf. 'showThy') printThy :: Thy -> IO () printThy = putStrLn . showThy +-- | Pretty-prints a theory into a string. (cf. 'printThy') showThy :: Thy -> String showThy thy = (if null rs then "no rules.\n"
stack.yaml view
@@ -1,8 +1,8 @@-resolver: lts-17.9 # or ghc-8.10.4+resolver: lts-19.19 # or ghc-9.0.2 packages: - . extra-deps:-- leancheck-0.9.10-- express-1.0.6+- leancheck-1.0.0+- express-1.0.10
test/expr.hs view
@@ -57,15 +57,19 @@ , (yy,ff2 xx xx) ] ]--ff2 :: Expr -> Expr -> Expr-ff2 e1 e2 = ffE :$ e1 :$ e2- where ffE = value "f" (undefined :: Int -> Int -> Int)+ where+ -- now uneeded as Data.Express.Fixtures exports something of sorts+ ff2 :: Expr -> Expr -> Expr+ ff2 e1 e2 = ffE :$ e1 :$ e2+ where ffE = value "f" (undefined :: Int -> Int -> Int)+ -- however there ffE = var "f" (...)+ -- so I am keeping a local definition of ff2 here+ -- to make it uniform with hh5 and hh7 -hh5 :: Expr -> Expr -> Expr -> Expr -> Expr -> Expr-hh5 e1 e2 e3 e4 e5 = hhE :$ e1 :$ e2 :$ e3 :$ e4 :$ e5- where hhE = value "h" (undefined :: Int -> Int -> Int -> Int -> Int -> Int)+ hh5 :: Expr -> Expr -> Expr -> Expr -> Expr -> Expr+ hh5 e1 e2 e3 e4 e5 = hhE :$ e1 :$ e2 :$ e3 :$ e4 :$ e5+ where hhE = value "h" (undefined :: Int -> Int -> Int -> Int -> Int -> Int) -hh7 :: Expr -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr-hh7 e1 e2 e3 e4 e5 e6 e7 = hhE :$ e1 :$ e2 :$ e3 :$ e4 :$ e5 :$ e6 :$ e7- where hhE = value "h" (undefined :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int)+ hh7 :: Expr -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr+ hh7 e1 e2 e3 e4 e5 e6 e7 = hhE :$ e1 :$ e2 :$ e3 :$ e4 :$ e5 :$ e6 :$ e7+ where hhE = value "h" (undefined :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int)
test/sdist view
@@ -2,7 +2,7 @@ # # test/sdist: tests the package generated by "cabal sdist". #-# Copyright (c) 2015-2021 Rudy Matela.+# Copyright (c) 2015-2023 Rudy Matela. # Distributed under the 3-Clause BSD licence. set -xe@@ -29,7 +29,11 @@ tar -tf $pkg | sort --ignore-case --unique > $tmp/ls-cabal-iu diff -rud $tmp/ls-cabal-i $tmp/ls-cabal-iu -if [ -d .git ]+# Check if we have a clone of the repo and git is available+# The check that we can run git ls-files is needed to avoid:+# fatal: detected dubious ownership in repository at '/__w/.../hello-haskell'+# on CI.+if [ -d .git ] && git --version && git ls-files >/dev/null then # Test if files included by cabal are the same as files tracked in git. git ls-files | sort > $tmp/ls-git