Failing `cabal-docspec` properties
- Dominant language
- Haskell
- Stars
- 27
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
I am in the process of upgrading `intervals` to use a more recent version of `cabal-docspec` that checks properties (of the form `prop>`). While doing so, I encountered a [couple of property failures](https://github.com/ekmett/intervals/actions/runs/11595678616/job/32284864270#step:21:26):
```
[ 0.00002] ghc.info: /github/home/.ghcup/ghc/9.10.1/bin/ghc
[ 0.00065] process.0.start: cwd=/tmp /github/home/.ghcup/ghc/9.10.1/bin/ghc --info
[ 0.04023] docspec.component: intervals-0.9.2 lib
[ 0.04102] docspec.phase1: Numeric.Interval: /__w/intervals/intervals/unpacked/intervals-0.9.2/src/Numeric/Interval.hs
[ 0.04142] docspec.phase1: Numeric.Interval.Exception: /__w/intervals/intervals/unpacked/intervals-0.9.2/src/Numeric/Interval/Exception.hs
[ 0.04191] docspec.phase1: Numeric.Interval.Internal: /__w/intervals/intervals/unpacked/intervals-0.9.2/src/Numeric/Interval/Internal.hs
[ 0.04756] docspec.phase1: Numeric.Interval.Kaucher: /__w/intervals/intervals/unpacked/intervals-0.9.2/src/Numeric/Interval/Kaucher.hs
[ 0.05295] docspec.phase1: Numeric.Interval.NonEmpty: /__w/intervals/intervals/unpacked/intervals-0.9.2/src/Numeric/Interval/NonEmpty.hs
[ 0.05347] docspec.phase1: Numeric.Interval.NonEmpty.Internal: /__w/intervals/intervals/unpacked/intervals-0.9.2/src/Numeric/Interval/NonEmpty/Internal.hs
[ 0.16529] docspec.phase2: Numeric.Interval.Internal
[ 0.91571] docspec.phase2: Numeric.Interval.Kaucher
[ 1.61083] docspec.phase2: Numeric.Interval.NonEmpty.Internal
[ 2.86624] error: ys /= singleton 0 ==> conservative2 ((/) :: Double -> Double -> Double) (/) xs ys
[ 2.86659] error: in comment at 424:1
*** Failed! Falsified (after 5 tests):
0.821158470731245 ... 4.0
0.0 ... 1.25
(2.4640645816081226,0.17305178762038978)
[ 3.78685] error: abs x >= 1 ==> (scale (x :: Double) i) `contains` i
[ 3.78719] error: in comment at 787:1
*** Failed! Falsified (after 24 tests and 1 shrink):
0.40812576620489693 ... 0.6
1.0
[ 4.25925] doctest.summary:
Total: 321; Tried: 317; Skipped: 4; Success: 315; Errors: 2; Failures 0
Examples: 242; Tried: 240; Skipped: 2; Success: 240; Errors: 0; Failures 0
Properties: 53; Tried: 51; Skipped: 2; Success: 49; Errors: 2; Failures 0
Setup: 26; Tried: 26; Skipped: 0; Success: 26; Errors: 0; Failures 0
[ 4.26030] error: there were errors or property failures
```
For now, I am going to disable these properties, but we should investigate why they are failing and how to repair them.
Contributor guide
No contributing guide indexed for this repository
Research direction
The failures are reported in the interval source modules inspected by cabal-docspec, at comments around lines 424 and 787. Start by rerunning the linked GitHub Actions job with property checking enabled, then investigate the counterexamples for conservative2 division and scale and establish the intended behavior before making the properties pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100