Skip to content
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

Add fixup combinators to ImpTest framework #4241

Merged
merged 1 commit into from Apr 11, 2024
Merged

Conversation

teodanciu
Copy link
Contributor

Description

Resolves #4209

Checklist

  • 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 .cabal and CHANGELOG.md files according to the
    versioning process.
  • The version bounds in .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)
  • All visible changes are prepended to the latest section of a CHANGELOG.md for the affected packages. New section is never added with the code changes. (See RELEASING.md)
  • Code is formatted with fourmolu (use scripts/fourmolize.sh)
  • Cabal files are formatted (use scripts/cabal-format.sh)
  • hie.yaml has been updated (use scripts/gen-hie.sh)
  • Self-reviewed the diff

@teodanciu teodanciu marked this pull request as ready for review April 5, 2024 13:03
Copy link
Contributor

@Soupstraw Soupstraw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, even better than what I had in mind!

Copy link
Contributor

@lehins lehins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! I have even a follow up idea how we can make it even better:

Let's get rid of iteDoTxFixup and itePostFixup in favor of one: iteFixup :: Tx era -> ImpTestM era (Tx era)

For times when no fixup is necessary we can just use pure, while by default in the runImpTestM we can use fixupTx.

Then withPostFixup will become a composition of the current fixup function that is currently set in iteFixup and the one that is supplied as an argument.

@Soupstraw what are your thoughts on this subject? Asking you since you really advocated for a boolean flag.

@Soupstraw
Copy link
Contributor

Soupstraw commented Apr 8, 2024

Let's get rid of iteDoTxFixup and itePostFixup in favor of one: iteFixup :: Tx era -> ImpTestM era (Tx era)

@lehins I like that idea, it's a more flexible version of what we have right now. We can still keep the withNoFixup combinator around for convenience, just make it set the fixup function to pure.

@teodanciu teodanciu force-pushed the td/imp-post-fixup-hook branch 3 times, most recently from d54d4d2 to 01f5726 Compare April 9, 2024 16:12
@teodanciu
Copy link
Contributor Author

I pushed some changes that I believe implement what @lehins 's suggestion was .

I have doubts about how this will be used!
So:

  • for no fixup at all: withNoFixup - as before
  • for "auto fixup" and extra things: withPostFixup
  • for only extra things, we'll have to do: withPostFixup (\f -> withNoFixup ( ..)
    Isn't it kinda clunky ? I have looked at this too much to have an objective view, so happy to go with it if you think so. @lehins @Soupstraw

Copy link
Contributor

@lehins lehins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! One tiny mistake and a suggestion

@teodanciu teodanciu force-pushed the td/imp-post-fixup-hook branch 2 times, most recently from 39bd545 to ee4b52d Compare April 10, 2024 12:47
@teodanciu teodanciu changed the title Add withPostFixup to ImpTest framework Add fixup combinators to ImpTest framework Apr 10, 2024
Copy link
Contributor

@lehins lehins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@lehins lehins merged commit 0adbd6a into master Apr 11, 2024
15 checks passed
@lehins lehins deleted the td/imp-post-fixup-hook branch April 11, 2024 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a postFixupHook function to ImpTest
3 participants