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

Distinguish instance parameter from mixin parameter #347

Open
CohenCyril opened this issue Mar 15, 2023 · 1 comment
Open

Distinguish instance parameter from mixin parameter #347

CohenCyril opened this issue Mar 15, 2023 · 1 comment

Comments

@CohenCyril
Copy link
Member

CohenCyril commented Mar 15, 2023

In the refactoring to get instances before structure declaration, one must be careful to distinguish the two kinds of parameters.
Mixin parameters of an instance are the parameters that occur in the type of the mixin (as arguments of mixins), anything is allowed since anything can be inferred by type inference. However, instance parameters, which are the parameters of instances that do not occur in mixin arguments are only inferable if they are part of a resolution mechanism (HB or in mixed cases hand made declared CS or typeclass instances, which we should not care about in a first pass).

In the following example, P is a mixin parameter while T is an instance parameter.

HB.mixin Record is_foo P A := { op : P -> A -> A}.
HB.instance Definition foo_nat P := is_foo.Build P nat (fun _ x => x).
HB.instance Definition foo_list P T := is_foo.Build P (list T) (fun _ x => x).

When applying mixin-src->has-mixin-instance we should examine each parameter of the mixin instance and decide which is a mixin parameter and which is an instance parameter and write down their number encode it as a list of booleans for use in mk-src

CC @ThomasPortet @gares

ThomasPortet added a commit to ThomasPortet/hierarchy-builder that referenced this issue Mar 15, 2023
gares pushed a commit that referenced this issue Oct 4, 2023
gares pushed a commit that referenced this issue Oct 5, 2023
@proux01
Copy link
Contributor

proux01 commented Dec 11, 2024

Maybe look at #475

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants