Closed coot closed 1 month ago
C.f. #279.
The tricky thing here is deciding if this is the right point on the tradeoff spectrum. Maybe having Monoid Property and Any as an option is another good option? Another problem here is that the names Any and All are taken in base.
The build also fails on a bunch of older GHC versions (and Hugs) but thats not a huge deal - it should be pretty easy to address.
The tricky thing here is deciding if this is the right point on the tradeoff spectrum.
Note that All
is more general than Property
, as it is an existential type which can hold any Testable p => p
. When I discussed this with John, we came up with this design as it gives a lot of flexibility in writing things like Any p <> label ...
, or even Any p .||. Any p'
etc. I am not sure how limiting p :: Property
is in general (at least, I don't usually write code which is polymorphic with Testable
constraint), but in other areas, e.g. for teaching purposes, people are taking advantage of it, so students do not need to write type annotations, or modify them when playing with code.
@MaximilianAlgehed I addressed your comments.
Great! Please fix the build failures and I'll have a look next week! (OOTO this week)
@MaximilianAlgehed could you approve the workflows to run?
Something went terribly wrong with all the linux jobs:
Run actions/checkout@v3
/usr/bin/docker exec f8c8e73e602a1181103553ab346548bbea1153df1ee39cd8bca903f874d0dd8f sh -c "cat /etc/*release | grep ^ID"
/__e/node20/bin/node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /__e/node20/bin/node)
Let's try to re-run them.
@coot I'm working on a fix for the CI issue in #412
@coot sorry for the delay but the fix has been merged
I rebased this PR.
Ok, sorry... You need to rebase again because I screwed up with the semantics of github actions and the difference between "run on push" and "run on PR". There is no neat way to get "run on push and also run on PR from forks"... Anway, hopefully this works for now.
Done.
Let's see if I fixed 7.10.3
. I was getting a linking error with ghc-7.10.3
locally.
All
is a monoid build around.&&.
. It is useful when writing complex properties which check multiple conditions. Since it is a monoid it allows one to usefoldMap
which is often much more ergonomic than usingconjoin
.All
satisfiesmonoid
laws up toisSuccess
, unless one is usingcheckCoverage
&cover
. I'd argue this is not a problem sincecheckCoverage
andcover
are most often added at the top of the property.This patch also adds
Any
monoid build around.||.
.Tests are also included.