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

Split type classes out of eras Core module #3924

Merged
merged 10 commits into from Dec 14, 2023
Merged

Conversation

lehins
Copy link
Contributor

@lehins lehins commented Dec 12, 2023

Description

The idea of defining all core classes in a single module have proved to be a suboptimal and not always possible. Quite often it resulted in cyclic module dependency issues, which usually could be worked around, but not always.

Major goal of this PR is to move class definitions to their respective modules (eg, BabbageEraTxOut into Cardano.Ledger.Babbage.TxOut), while still re-exporting all of the core classes from the core modules. In other words dependency direction is inverted when it comes to the Core modules.

Along with this restructure, some of the re-exportations have been cleaned up and a bunch of deprecated functions have been removed. All of which have been noted in the CHANGELOGs

  • cardano-ledger-core:
    • Move Cardano.Ledger.Keys to hidden module Cardano.Ledger.Keys.Internal and re-export all three modules from Cardano.Ledger.Keys
      • Cardano.Ledger.Keys.Internal
      • Cardano.Ledger.Keys.Bootstrap
      • and Cardano.Ledger.Keys.WitsVKey
  • cardano-ledger-shelley/marry/allegra/alonzo/babbage/conway:
    • Move [Era]Era[Type]: from Cardano.Ledger.[Era].Core to Cardano.Ledger.[Era].[Type]. For example move ShelleyEraTxBody: from Cardano.Ledger.Shelley.Core to Cardano.Ledger.Shelley.TxBody
    • Re-export all core type classes from Cardano.Ledger.[Era].Core
    • Stop exporting from Cardano.Ledger.[Era].Core internal PParams hkd* lenses and type families. Only export dedicated lenses for dealing with PParams and PParamsUpdate, not the PParamsHKD
    • Stop exporting types that are not relevant for the module (eg. exporting PoolParams or ShelleyEraTxOut from Cardano.Ledger.Shelley.TxBody)

In other words, there are no semantic changes in this PR, just reorganization. One small exception is the ToJSON instances for PoolVotingThresholds and DRepVotingThreshold where implemented manually instead of deriving using DeriveAnyClass.

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

@lehins lehins force-pushed the lehins/split-out-era-core branch 5 times, most recently from 9b17ea4 to 9e9797d Compare December 13, 2023 02:47
@lehins lehins marked this pull request as ready for review December 13, 2023 02:52
@lehins lehins force-pushed the lehins/split-out-era-core branch 3 times, most recently from 72a13ba to 873a0a7 Compare December 13, 2023 19:56
@lehins lehins changed the title Split out era core Split type classes out of eras Core module Dec 13, 2023
Copy link
Contributor

@teodanciu teodanciu left a comment

Choose a reason for hiding this comment

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

Looks good to me. And nice to have all these deprecated stuff removed.

* Move core type class definitions to modules where instances are defined.
* Remove unnecessary re-exports
* Remove derpecated functions
* Move core type class definitions to modules where instances are defined.
* Remove unnecessary re-exports
* Remove derpecated functions
* Move core type class definitions to modules where instances are defined.
* Remove unnecessary re-exports
* Remove derpecated functions
* Move core type class definitions to modules where instances are defined.
* Remove unnecessary re-exports
* Remove derpecated functions
* Move core type class definitions to modules where instances are defined.
* Remove unnecessary re-exports
* Remove derpecated functions
* Move core type class definitions to modules where instances are defined.
* Remove unnecessary re-exports
* Remove derpecated functions
* types, type classes and functions
* Import all Core instances into Core modules
@lehins lehins merged commit 44378d3 into master Dec 14, 2023
11 of 17 checks passed
@iohk-bors iohk-bors bot deleted the lehins/split-out-era-core branch December 14, 2023 03:20
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

2 participants