-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Newconstraints phase3, Add newtypes: Size, SizeSpec and class Sized. #4121
Conversation
3844bd3
to
5be9268
Compare
c194f4b
to
50df72d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have left some comments, but I haven't gone over all the changes to Base
in detail yet. There is a lot of stuff around the Size
stuff that already exists for Integer
and the other numeric types. I think it would be wise to drop Size
as a type, in favour of Integer
(to avoid wrapping issues when computing cardinality
for e.g. Word64
).
After we've revamped |
50df72d
to
9a9791a
Compare
@TimSheard how do you feel about |
There is ugly issue with
|
9a9791a
to
bcd56e0
Compare
I am thinking that we make Size = Integer. |
With that solution |
bcd56e0
to
ca80f9e
Compare
Yes, that would be right. Any take a look, I have swithced to Size = Integer |
ca80f9e
to
15c7e28
Compare
3e0a6ae
to
303a73a
Compare
Added Num (NumSpec fn Integer) and Num (Spec fn Int) instances. Added Num (NumSpec Integer) tests Added (HasSpec fn t) method 'typeSpecOpt'
Revoved the synonym: type Size = Intgeger Addressed all other conversations. Co-authored-by: Maximilian Algehed <MaximilianAlgehed@users.noreply.github.com>
303a73a
to
ea1b76f
Compare
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.
instances include Int, Set, List, Map, and Size itself.
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
.cabal
andCHANGELOG.md
files according to theversioning process.
.cabal
files 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)CHANGELOG.md
for the affected packages. New section is never added with the code changes. (See RELEASING.md)fourmolu
(usescripts/fourmolize.sh
)scripts/cabal-format.sh
)hie.yaml
has been updated (usescripts/gen-hie.sh
)