-
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
Rename AnyEraInEon
to EraInEon
#289
Conversation
@@ -163,38 +162,24 @@ maybeEon = | |||
-- ---------------------------------------------------------------------------- | |||
-- Era and eon existential types | |||
|
|||
data AnyEraInEon eon where | |||
AnyEraInEon | |||
data EraInEon eon 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 Any
prefix was useful here, we were using it to denote an existential.
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 originally thought of Any
as representing the existential, but it doesn't have to be the only way to represent the existential.
We can review some examples:
data AnyConsensusModeParams where
AnyConsensusModeParams :: ConsensusModeParams mode -> AnyConsensusModeParams
data AnyConsensusMode where
AnyConsensusMode :: ConsensusMode mode -> AnyConsensusMode
data AnyScriptLanguage where
AnyScriptLanguage :: ScriptLanguage lang -> AnyScriptLanguage
data AnyPlutusScriptVersion where
AnyPlutusScriptVersion :: PlutusScriptVersion lang -> AnyPlutusScriptVersion
I think in all the above cases, the Any
prefix fits because they match the pattern AnyX
where X
is the thing we are quantifying over.
These however, I think are different:
data AnyEraInMode mode where
AnyEraInMode :: EraInMode era mode -> AnyEraInMode mode
data AnyEraInEon eon where
AnyEraInEon
:: ( Typeable era
, Typeable (eon era)
, Eon eon )
=> eon era
-> AnyEraInEon eon
We are not quantifying over EraInMode
or EraInEon
, we are just quantifying over the era. The Eon part or the Mode part continues to be parameterised.
I think in these cases, it is appropriate to just call it EraInMode
or EraInEon
where pattern XInY
means quantifying X
for a given Y
.
data AnyScriptWitness era where
AnyScriptWitness :: ScriptWitness witctx era -> AnyScriptWitness era
This one is a bit special. The only way it makes sense for me is if it were named ScriptWitnessInAnyWitnessContext
, so it doesn't follow either of the two conventions above.
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 still not convinced and I think in your example both are the same - in both cases in AnyEraInMode mode
and AnyEraInEon eon
we're quantifying over eras.
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.
Either we should remove Any
prefixes from all existentials, or leave it as it is.
not blocking if you guys feel that's the way
Okay. Making the call to merge since I'm leaning towards the change and have the casting vote. |
Changelog
Context
This simplifies the type name. The
Any
prefix is not needed to understand what the type does.Checklist
See Running tests for more details
.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