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

Replace IsCardanoEra and IsShelleyBasedEra contraints in GADT constructors with Typeable #354

Merged
merged 2 commits into from
Nov 9, 2023

Conversation

newhoggy
Copy link
Collaborator

@newhoggy newhoggy commented Nov 5, 2023

Changelog

- description: |
    Replace `IsCardanoEra` and `IsShelleyBasedEra` contraints in GADT constructors with `Typeable`
# uncomment types applicable to the change:
  type:
  # - feature        # introduces a new feature
  - breaking       # the API has changed in a breaking way
  # - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
  - improvement    # QoL changes e.g. refactoring
  # - bugfix         # fixes a defect
  # - test           # fixes/modifies tests
  # - maintenance    # not directly related to the code
  # - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...

Context

There are very few places where we need IsCardanoEra and IsShelleyBasedEra in these GADTs.

In these few remaining places, cardanoEraConstraints and shelleyBaseConstraints can be used to get the constraints instead.

Removing these constraints is helpful because whilst it makes it more convenient when unpacking the GADT, when constructing the GADT it is more inconvenient because the declared constraints need to be available on construction.

Moreover, the removal of these constraints makes the modified GADTs more compatible with EraInEon.

Downstream cardano-cli changes: IntersectMBO/cardano-cli#435

How to trust this PR

Highlight important bits of the PR that will make the review faster. If there are commands the reviewer can run to observe the new behavior, describe them.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff

Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

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

What does this change look like in cardano-cli?

@newhoggy
Copy link
Collaborator Author

newhoggy commented Nov 7, 2023

What does this change look like in cardano-cli?

There is a link in the PR description.

@newhoggy newhoggy added this pull request to the merge queue Nov 9, 2023
Merged via the queue into main with commit 7c34db0 Nov 9, 2023
24 checks passed
@newhoggy newhoggy deleted the newhoggy/remove-constraints-from-constructors branch November 9, 2023 15:40
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.

None yet

4 participants