cardano-ledger
cardano-ledger copied to clipboard
Newconstraints phase3, Add newtypes: Size, SizeSpec and class Sized.
This is a follow on PR. Originally rebased on top of PR #4120, it is now rebased on the current master, and 4120 has been closed.
Spec does 3 things.
- Adds generic size functions on numerous types with HasSpec instances, by adding Sized instances. Current instances include Int, Set, List, Map, and Size itself.
- Retracts the And opertor from BoolFn, which turned out to have some technical difficulties.
- Adds the methods 'cardinalTypeSpec' and 'cardinalTrueSpec', these allow any HasSpec instance to use the function cardinality :: HasSpec fn t => Spec fn t -> Spec fn Int. It computes bounds on the total number of possible solutions generated by 'genFromTypeSpec' This supports tighter (more accurate) bounds in a number of places.
Checklist
- [x] Commit sequence broadly makes sense and commits have useful messages
- [ ] New tests are added if needed and existing tests are updated
- [ ] When applicable, versions are updated in
.cabalandCHANGELOG.mdfiles according to the versioning process. - [ ] The version bounds in
.cabalfiles for all affected packages are updated. If you change the bounds in a cabal file, that package itself must have a version increase. (See RELEASING.md) - [ ] All visible changes are prepended to the latest section of a
CHANGELOG.mdfor the affected packages. New section is never added with the code changes. (See RELEASING.md) - [x] Code is formatted with
fourmolu(usescripts/fourmolize.sh) - [x] Cabal files are formatted (use
scripts/cabal-format.sh) - [x]
hie.yamlhas been updated (usescripts/gen-hie.sh) - [ ] Self-reviewed the diff