-
Notifications
You must be signed in to change notification settings - Fork 480
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PLT-1611: Fix Interval for discrete intervals
`Interval` was not in a good place. It violated a bunch of laws. The first thing this PR does is add a bunch more tests: - Generic tests for the typeclasses that `Interval` has instances of. - Some specific tests that test that finite intervals behave the same as sets of consecutive numbers. The latter gives us a "semantic" test that lets us check whether our operations on intervals are doing the right thing with respect to a model - in this case the model is the set of values that fall into the inteval. Then we need to actually fix `Interval`. The most straightforward solution I could see is just to restrict most of its operations to intervals on enumerable types. That lets us turn non-inclusive bounds into inclusive bounds, which simplifies things a lot. Without that information, we can't easily even tell if e.g. an interval is empty or not. Arguably we should just have never had non-inclusive bounds in the first place and it's unnecessary generality. However, I think changing that now would be more disruptive than it is worth. Fixes #5185
- Loading branch information
Showing
9 changed files
with
432 additions
and
71 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
plutus-ledger-api/changelog.d/20230302_163021_michael.peyton-jones_fix_interval.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Fixed | ||
|
||
- Fixed numerous bugs in the behaviour of `Interval`s with open endpoints. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.