-
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
Expose CurrentEra and UpcomingEra pattern synonyms #414
Conversation
202cbf2
to
556450b
Compare
29c1603
to
0fbb6fb
Compare
-- doThing :: Era era -> () | ||
-- doThing = \case | ||
-- CurrentEra' -> enableFeature | ||
-- UpcomingEra' -> disableFeature |
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.
Add comment elaborating on why this is undesirable i.e updating the type synonyms will go unnoticed by consumers. Also include comment in this module explaining how we will deprecate eras.
CurrentEra | ||
:: SupportedProtocolVersionRange BabbageEra | ||
=> Era BabbageEra | ||
CurrentEra' |
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 think being clear that this constructor should not be used would be better than just apostrophe.
CurrentEra' | |
UnsafeCurrentEra |
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.
Unsafe implies something breaks the type system, memory safety etc. I'll append Internal
to the constructors
045f9f2
to
3cd3610
Compare
3cd3610
to
442b5c8
Compare
721fd66
to
74966c0
Compare
74966c0
to
e999814
Compare
|
||
4. Add new 'UseEra' instance and keep the deprecated era's instance. | ||
@ | ||
instance UseEra BabbageEra 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 think we can add also a TypeError
here e.g.:
instance TypeError (Text "BabbageEra no longer supported, use ConwayEra") => UseEra BabbageEra 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.
...or maybe not. I guess the point is to have the project buildable, but also generate a deprecation warning.
|
||
4. Add new 'UseEra' instance and keep the deprecated era's instance. | ||
@ | ||
instance UseEra BabbageEra 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.
...or maybe not. I guess the point is to have the project buildable, but also generate a deprecation warning.
( MinSupportedVersion <= version | ||
, version <= MaxSupportedVersion | ||
) | ||
data BabbageEra |
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.
What's the "lifecycle" of uninhabited era types? After forking to conway, will we remove the old era, or leave it for some time?
…t-types-for-poll-commands Command argument types for poll commands
@carbolymer pointed out the following situation and suggested the use of pattern synonyms to remedy it.
Changelog
Context
Additional context for the PR goes here. If the PR fixes a particular issue please provide a link to the issue.
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