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
Freeze metas in module telescope after checking the module? #1063
Comments
Original comment by
|
Original comment by |
Original comment by |
One could argue that module _ mtel where
f : A
f ps = t should behave like f : mtel -> A
f mtel ps = t which would suggest to not freeze the metas of mtel before checking f. Original comment by |
Original comment by
|
The current situation is actually that we freeze metas after the first declaration in the module: module _ where
module M (A : _) where
y = Set -- type of A is solved if this is removed
x : Set
x = A This is not a sensible behaviour. Two options:
The latter solution would require refactoring the way we freeze metas. At the moment we freeze all metas when freezing, but in this case we'd need to freeze metas from the declarations inside the module, but leave the parameter metas unfrozen. This might also lead to some unpredictable behaviour when there are dependencies between parameter metas and local metas. I'd lean towards the easy solution. |
I also vote for freezing metas from the module parameters right away. The alternative just seems to unpredictable/brittle. |
I vote for a more fine-grained freezing. Modules should behave similarly to the corresponding record types, which can have metas in their telescope which are resolved by the fields and definitions in the record. |
How do you propose to deal with the unpredictability/brittleness concerns in this case? Or are you saying we shouldn't freeze any metas inside modules (not even the top-level module?)? This is, I believe, how record types work at the moment. |
Actually @divipp already implemented the second alternative in 32220e0#diff-74c7bcc666176816c0d565cbaf6ef7c1R181 (without advertising it). So this issue has been fixed for 7 months already. I now feel stupid for wasting my Sunday on implementing the alternative solution, but I'm also happy I don't have to implement it myself. |
I suggest that we document the change. When are module parameter metas frozen? |
Modules are treated the same as other declarations in this respect, so any metas created while checking a module telescope are frozen at the end of that module. I'll add something to the changelog. |
Original issue reported on code.google.com by
mech...@botik.ru
on 18 Feb 2014 at 12:27The text was updated successfully, but these errors were encountered: