-
Notifications
You must be signed in to change notification settings - Fork 157
Made TxBody a data family #5005
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
Conversation
aebaabf
to
722d003
Compare
cf59cb6
to
646272e
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.
Can we just remove these types ShelleyTxBody
... ConwayTxBody
without deprecating them?
I suppose I could add type synonyms to address that issue. |
00f26b2
to
646272e
Compare
It's not so easy actually, when I try to deprecate the type synonym, it deprecates the pattern with the same name instead.. |
I just realized that these types are not exported in the API, so maybe it's not a big deal to remove them? |
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 is a welcome simplification, and the concretisation of era
in many places to a specific era removes a lot of noise and complexity.
Could the same technique be applied to some of the other abstract types that we have, such as TxOut
and TxCert
? If not, what's special about TxBody
? And if we can do it only for TxBody
then perhaps it makes the code more confusing since TxBody
is then handled differently to the way we handle all the other era-specific types.
I'm also concerned that removing the era
parameterisation in some places will reduce the reusability of the code. OTOH, since we already know now that things from earlier eras aren't going to be reused, perhaps it's good that we remove the complexity of that unnecessary reusability.
libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/Conway/Instances/TxBody.hs
Outdated
Show resolved
Hide resolved
libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/Conway/Instances/TxBody.hs
Outdated
Show resolved
Hide resolved
libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/Conway/Instances/TxBody.hs
Outdated
Show resolved
Hide resolved
libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/Conway/Instances/TxBody.hs
Outdated
Show resolved
Hide resolved
libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/Conway/Instances/TxBody.hs
Outdated
Show resolved
Hide resolved
646272e
to
f2bf54f
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.
Removing the era
from the raw tx bodies removes a lot more constraint noise. Nice!
18ee78c
to
928fb5b
Compare
@neilmayhew What makes The drawback of having a data family here is that now if we want to reuse a |
5b61a06
to
21f8a8c
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.
Looks good to me.
I think we should definitely mention in the changelog of each era the removal of <Era>TxBody
type, and since the Raw types are also exposed, the fact that we removed its era parameter.
libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/Conway/Instances/TxBody.hs
Outdated
Show resolved
Hide resolved
21f8a8c
to
5ce0cec
Compare
5ce0cec
to
9c3d7cd
Compare
Description
This PR changes
TxBody
from a type family to a data family.close #4999
Checklist
CHANGELOG.md
files updated for packages with externally visible changes.NOTE: New section is never added with the code changes. (See RELEASING.md).
.cabal
andCHANGELOG.md
files when necessary, according to theversioning process.
.cabal
files updated when necessary.NOTE: If bounds change in a cabal file, that package itself must have a version increase. (See RELEASING.md).
scripts/fourmolize.sh
).scripts/cabal-format.sh
).scripts/gen-cddl.sh
)hie.yaml
updated (usescripts/gen-hie.sh
).