Closed
Conversation
Contributor
Author
|
(I'll grab this comment as a todo list/current status, leaving the OP as an overview of the PR). Status: nothing to see here code-wise, just opening a PR for a place to put some notes whilst this is in development. This PR is work towards #870 Note to self: some messy wip is at https://github.com/hackworthltd/primer/tree/brprice/wip/saturated-constructors Todo (perhaps some of this should go in the FR #870):
but it would be interesting to explore (for UX reasons) the synthesising rules both from a "hack this up for UX" and a "do it properly with decent metatheory" perspectives
Roadmap:
|
f208a4b to
e159d1f
Compare
Since the names are unique and the ordering information is exposed in the input and second output, we can make the types reflect the fact that the substitution does not need to be applied in any particular order. (This will shortly work nicely with a forthcoming notion of simultaneous substitution.)
This makes its telescopic nature clear at callsites.
Sometimes one needs capture-avoiding substitution of many variables simultaneously. This is no harder than substituting one variable, so we make this the primitive.
Everywhere we substitute multiple types we actually do not care whether the substitution is telescopic or simultaneous. The only non-singleton substitutions we use are from one of - 'genInstApp's output (or the accumulated substitution in its helper 'reify') - 'unify's output These are both idempotent (i.e. the substituted types do not refer to any of the names being substituted away), and thus both sorts of substitution will return the same value. Thus we should use the more efficient simultaneous substitution (which only has to traverse the tree once).
…bstitution' into brprice/tmp/saturated-constructors-split-base
49168b5 to
a321aac
Compare
Other option would to be change 'map' to use unsat con, but then (iiuc) I wouldn't have found the other bugs (don't look under con in Eval and focusOn and freeVars)
a321aac to
da5b6a3
Compare
AIM: play around with conSat interactively and find what actions we offer under them. It seem that we offer the expected set, which is good! Now it actually creates a conSat. However, this only happens if we use the ConstructSaturatedCon, not ConstructRefinedCon, and thus in an openapi frontend only happens using the MakeConSat action in a position with no type info (i.e. where the type is a hole). In particular, in the program Cons @[?_1] [?_2, ?_3] we have - ?_2 : ?_1, so we would do a conSat here - ?_3 : List ?_1, but we would not here (do a refine)
YES, it seems so (have rebased to not do API hack, and updated insert sat con action. Interactively it seems that we offer expected stuff) This reverts commit 05fc6ac.
These have to change together as EvalFull.8,9,prim_partial_map all compare map output with list_
da5b6a3 to
b415db7
Compare
This was referenced May 10, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We enforce all (value) constructors must be fully-saturated. They will no longer carry their indices, i.e. we will have
Just Truerather thanJust @Bool True. This implies that their typing rules must change, since we currently use these indices to infer types.This change will introduce much symmetry between constructions and pattern matching of ADTs. It will also make some expressions much more concise (especially lists) due to not having type applications.