-
Notifications
You must be signed in to change notification settings - Fork 23
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
Improved feature ergonomics #128
Conversation
{-# DEPRECATED asFeatureValueInShelleyBasedEra "Use asFeaturedInShelleyBasedEra instead" #-} | ||
|
||
-- | A value only if the feature is supported in this era | ||
data Featured feature era a where |
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.
I'm skeptical about introducing another abstraction as we are in the process of handing over part of cardano-api to the ledger team. We don't want additional churn as we have an October target we need to hit. Where do you envision this being used?
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.
I'm anticipating that we it will be used in the CLI parser.
For example we currently don't have a good way to say some value that's passed into the run function from the parser is mandatory but only for a particular era.
This change is also a simplification of existing code. Currently FeatureValue
includes optionality, which I think is better modelled via Maybe
.
I think this data type will also provide us a good way to shrink our API, which would mean less code to maintain and make the handover easier.
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.
We can postpone the merge of this PR until after the next cardano-api
release.
caf19b3
to
eeaa954
Compare
eeaa954
to
fca2ac6
Compare
fca2ac6
to
24e6df1
Compare
All the non-breaking changes from #132 have been moved into this PR. |
…y-gen #128 DRep key generation
Changelog
Context
Note, the following is an example only. We do not have to do the described refactoring until we need it.
Currently we define era-sensitive features like this:
And then separately define era-sensitive values like this:
The
TxInsCollateral
can only be used with the witnessCollateralSupportedInEra era
which can only be constructed within certain eras.This PR proposes to define like this instead:
Then the definitions of
data TxInsCollateral era
is unnecessary. Once could just useMaybe (Featured CollateralSupportedInEra era [TxIn]
. Just likeTxInsCollateral
the value can be absent, but usingNothing
instead ofTxInsCollateralNone
.Featured CollateralSupportedInEra era [TxIn]
is better thandata TxInsCollateral era
in that the former can express that the value is required, which also forces the era to be one that the era supports. This will be useful in definingrun
commands where the arguments are required which currently cannot be done without defining additional types.Checklist
.cabal
files are updatedhlint
. See.github/workflows/check-hlint.yml
to get thehlint
versionstylish-haskell
. See.github/workflows/stylish-haskell.yml
to get thestylish-haskell
versionghc-8.10.7
andghc-9.2.7
Note on CI
If your PR is from a fork, the necessary CI jobs won't trigger automatically for security reasons.
You will need to get someone with write privileges. Please contact IOG node developers to do this
for you.