Merged
Conversation
As with `moduleDefs` (already a map), we often need to look up elements in it anyway. See, for example, all of the calls to `mkTypeDefMap` which previously existed in the `EvalFull` module (but not `Eval`, where we already required the caller to pass the definitions as a map).
Analogous to `unsafeGlobalName`. Very mildly simplifies some existing code, though we'll use it again shortly.
georgefst
commented
Apr 7, 2022
We ensure that the student's program continues to typecheck, by adding holes as necessary.
67d06db to
4b4f0b6
Compare
georgefst
commented
Apr 11, 2022
brprice
reviewed
Apr 11, 2022
brprice
reviewed
Apr 11, 2022
brprice
reviewed
Apr 11, 2022
brprice
reviewed
Apr 11, 2022
brprice
reviewed
Apr 11, 2022
brprice
reviewed
Apr 11, 2022
brprice
reviewed
Apr 11, 2022
brprice
reviewed
Apr 11, 2022
brprice
reviewed
Apr 11, 2022
brprice
reviewed
Apr 11, 2022
brprice
reviewed
Apr 11, 2022
brprice
reviewed
Apr 11, 2022
brprice
reviewed
Apr 11, 2022
brprice
reviewed
Apr 11, 2022
We can use `uniplate` instead, which also removes some boilerplate.
We include a regression test, which would have failed before this commit.
…f a typedef This is important in order to be consistent with `checkTypeDefs`.
Member
|
(Note: before this can be merged via Mergify, you'll need to mark every conversation as "resolved." We talked about relaxing this recently, and I apologize that I haven't gotten around to it yet.) edit #387, but let's merge this first. |
Contributor
Author
Thanks, I had forgotten that. Ordinarily I would have left #367 (comment) and #367 (comment) open, since they aren't so much "resolved" as we've just decided they aren't particularly important. |
2 tasks
This was referenced Apr 14, 2022
This was referenced May 9, 2022
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.
Closes #267. Although I've edited the "future work" section there, to draw attention to some limitations which were implicit in the original spec, and became clear during implementation.
There is one part of the spec which we don't implement here: it says that we don't add unnecessary holes - see e.g. "when the program does not otherwise typecheck". But in this PR, we are cautious and always add holes where they may be needed, without examining the wider context. Some discussion is still needed around implementating this. The simplest approach seems to be to add the hole, then try to clean up by running the typechecker with smart holes enabled (this is a bit of a sledgehammer, and we might be able to improve performance with a cleverer approach, but I think we already do similar elsewhere). There's a WIP at https://github.com/hackworthltd/primer/tree/georgefst/editable-typedefs-1-smartholes. The implementation might not need to be very complex, but there's no real harm in splitting it out in to a follow-up PR - the work in this one has already been in flight for long enough, without adding anything else.
There are some decisions about name clashing to be tackled as part of #359, #332 etc. For now, we check the minimum e.g. that type names don't clash with each other.
Note that there are some fairly (but not completely) tangential drive-by refactors in the first few commits. I could split the main "Add actions for incrementally editing type definitions" commit up more (i.e. one commit for each new action), but it just doesn't seem like a great use of time after the fact - it would mostly be a lot of busywork with fiddling imports.
Performance could be slightly better in a few places. We have functions like
!?,insertAt,adjustAt, etc. which could take constant, rather than linear, time with the right data structures. This is not much of an issue for now as lists will be small in practice, and we have bigger performance issues elsewhere.