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

Use dependent types for PParams #678

Open
carlostome opened this issue Feb 4, 2025 · 1 comment
Open

Use dependent types for PParams #678

carlostome opened this issue Feb 4, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@carlostome
Copy link
Contributor

Change PParams to use dependent types in the spirit of the Shelley spec. For this, we replace the record by:

data PParamName : Type 
  maxBlockSize : PParamName

typeOfPParam : PParamName -> Type

PParams : Type
PParams = (ppn : PParamName) -> typeOfPParam ppn

PParamsUpdate : Type
PParamsUpdate = (ppn : PParamName) -> Maybe (typeOfPParam ppn)

PParamGroup : PParamName -> PParamGroup

This solves some awkwardness, for example, in that the current specification doesn't formally link parameter groups to parameters.

@WhatisRT WhatisRT added the enhancement New feature or request label Feb 5, 2025
@WhatisRT
Copy link
Collaborator

WhatisRT commented Feb 5, 2025

The potential downsides here are:

  • this uses dependent types visibly in the documentation
  • we can't do open PParams pp anymore (thought I guess we could make a big PParamsHelper module that contains definitions such as maxBlockSize pp = pp maxBlockSize' where maxBlockSize' is the renamed maxBlockSize from above)
  • no more postfix projections

Now that I think about it, I feel that these slightly outweigh the upsides. But maybe there are things that I haven't yet considered?

@WhatisRT WhatisRT mentioned this issue Feb 7, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants