-
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
Constrained v2 #3895
Constrained v2 #3895
Conversation
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.
There is a lot of stuff in here. I'm not going to have time to do a proper review until next week.
libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/V2/Conway/Ledger.hs
Outdated
Show resolved
Hide resolved
I think you got it. |
No nix crap in other words 😅 |
ec50741
to
1faca43
Compare
@lehins the formatter is broken again... |
@MaximilianAlgehed, Why do you say it is broken. Looks like |
It's passing now because I changed the code to work around the bug the tool itself told me that it has a few commits ago:
|
Looks like it chokes on some comments. I am not too worried about that, since comments can always be adjusted in a manner that makes fourmolu happy. An occasional hiccup like that is a very small price to pay for consistently formatted code that is actually readable. |
@lehins in this case the comments needed to be where they were to make sense (they were pointing out the type of each argument in a lambda without too much noise. But anyway, the comments are not a huge deal. Let's agree to disagree on the "actually readable" point. |
My main complaints with it are:
Anyway, I can deal with it but I would never turn it on myself. |
You would, if you were part of a big team of developers each with their own style of writing Haskell.
Every single one of those points slightly affects the aesthetics of the code, which I can certainly agree with. However, fourmolu is an enormous time saver:
Let me tell you, I will rather deal with slightly quirky looking code than the alternatives of:
Oh yeah, and one more point, fourmolu style is very git diff friendly! Which is another huge time saver.
Example with case alignment you pointed out is very git unfriendly.
It actually does, it is one of the configuration options which would apply throughout the codebase, which we choose not to enable. |
There was that one thing about assumptions and donkeys... I absolutely understand the point of using formatters, but the main issue I find is that they make code difficult to read. Pf course, opinions can differ on what makes code readable, but my opinion is that fourmolu is particularly quirky... But yes, the co-ordination problem is unfortunately particularily difficult to solve in Haskell - I dont know of any reasonable tools...
The problem with all these tools is that the inevitable quirks compound to make the code difficult to read. Now, you can argue on weather or not its code or diffs that should be read - my philosophy is that readable code is much more important than readable diffs. But reasonable people can differ on this point. |
I think it should sort of work if you put parentheses around |
@lehins and @Soupstraw I've marked this ready for review - it would be great if you wanted to take a look. There is still quite a lot left to do in terms of documentation and fixing some remaining issues, but I'm at the point where I'm anyway doing a lot of cleanup and writing a bunch of documentation so having some inputs during the process wouldn't be a bad thing. |
232d73c
to
4da8ea5
Compare
libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/V2/Conway/DelegCert.hs
Outdated
Show resolved
Hide resolved
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.
This looks great. Please address the conversations by improving the comment where indicated
libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/V2/Conway.hs
Outdated
Show resolved
Hide resolved
libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/V2/Conway.hs
Outdated
Show resolved
Hide resolved
libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/V2/Conway.hs
Outdated
Show resolved
Hide resolved
libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/V2/Conway/Ledger.hs
Outdated
Show resolved
Hide resolved
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.
LGTM, best get this merged soon so we can start experimenting with it
7c766d8
to
6c2d7e9
Compare
@lehins @Soupstraw and @TimSheard that's all the comments resolved for now, anything else just let me know. Now we have to try to get everything passing. |
2cdb68e
to
0d6bf82
Compare
51665d2
to
9c58129
Compare
This passes Haskell CI now. I had to do some acrobatics to make it build with 8.10.7, but nothing too horrendous. I have no idea what's up with the Hydra failures. It fails on nix things that I'm pretty sure we haven't messed with, but I could be wrong. If someone could take a look that would be much appreciated. |
9c58129
to
b06519f
Compare
@lehins Is the hydra failures anything to worry about or can we merge this? |
Nope, nothing to worry about |
Description
This PR introduces version 2 of the
Constrained
approach to generating random data.It's a significant overhaul of the existing approach and it's far from done. However, it is at the point where
it can be useful for writing properties (e.g. for the
GOV
rule) so getting at least a WIP PR up seems very valuable.Furthermore, if we can get this merged we might be able to start working on some of the STS property issues in parallel with improving this.
@lehins any guidance on setting up the separate package would be much appreciated - is there a README somewhere I should follow?
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
)