eliminate id function for inferred partial constraints in desugaring#3195
eliminate id function for inferred partial constraints in desugaring#3195matthewleon wants to merge 4 commits intopurescript:masterfrom
Conversation
* Revert "pretty print proxy types when rendering docs (purescript#3144)" This reverts commit 14227c7. * Revert "Print proxy type as an operator (purescript#3124)" This reverts commit cfd1db3. * Revert "Fix proxies: synonyms, inference, traversals, instances (purescript#3095)" This reverts commit fe0aa0d. * Revert "Add proxies (purescript#2846)" This reverts commit 74bc4a9. * Remove one last occurrence of the ProxyType constructor * Update tests to not use new proxies
Fixes purescript#3187 Rather than using the magic string "__unused" to represent generated names that are meant to go unused, we create a new Ident constructor for them. Instead of eliminating them as arguments in the optimization phase, they are stripped during the conversion from CoreFn to CoreImp.
fixes purescript#3157 During exhaustivity checking, an id function with a Partial constraint is created whenever a partial function is encountered, for the purposes of typechecking. During desugaring, typechecking is complete, so we can remove this construct.
The __unused constant for names is now fully supplanted by the use of UnusedIdent. We can get rid of it.
|
I discussed this with @kritzcreek and came to the conclusion that it shouldn't be sitting in the middle of the desugaring code. That said, it makes sense to perform this optimization between typechecking (the source of the generated block) and the functional core, as alternative backends shouldn't need to duplicate the optimization. Any ideas? |
|
Shall we close this then, since the approach is going to be different? |
sure |
|
I'm not sure how much you talked with @kritzcreek about this, but I chatted about it briefly with him a while ago too. My thinking was that there would also be an I was going to suggest making that change on the other PR even, and then keeping the "remove unused" pass in the optimizer there, but just having it less fragile since it'd have the constructor to match on... but in the end I figured it was fine to just not generate it at all. |
I did have a chat with @kritzcreek about this one. I think what you are proposing makes sense broadly speaking. As it stands, That said, for this particular problem, I believe it makes sense to do the optimization before even getting to Thoughts? |
|
Another clarification here is that the particular way that |
|
The reason |
Okay, cool. I will try to rewrite this in a |
|
If it doesn't work out for some reason, that's fine too - perhaps we'll need to reconsider how the intermediate parts fit together to make them more useful. |
fixes #3157
This depends on #3194. If that is merged, I'll rebase accordingly.
During exhaustivity checking, an id function with a Partial constraint is created whenever a partial function is encountered, for the purposes of typechecking. During desugaring, typechecking is complete, so we can remove this construct.