-
Notifications
You must be signed in to change notification settings - Fork 273
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
Allow UCM commands to have “unprocessed” arguments #5549
base: trunk
Are you sure you want to change the base?
Conversation
Great! |
IIRC, it used to be that the
unison/unison-cli/transcripts/Transcripts.hs Lines 129 to 151 in 2e6dd94
It looks like, for a given directory that we're going to run transcripts out of, we first look for any transcripts like Apart from that, I noticed we do see this pattern in many transcripts now, e.g.
Will that work for |
So, this is what caused my confusion last week – my previous usage of I don’t need to manually do the And separately, renaming |
Gotcha, makes sense.
I think adding a few definitions to base.u would be ok, or we could update it with the source of a newer version of base, if that works? But really the whole current system is a mess IMO. The "better" (though not good) solution I think would be to have a CI step that preps and caches a codebase with We also have #5543 ready to merge, though I'm not clear on whether this helps in this scenario or not. I'm thinking "no" until we are trying to cache multiple distinct libraries on a transcript-by-transcript basis.
Yeah I'm thinking more just that we wait on this step until we come up with a way for the whole thing to go away. Maybe when Share Sync v2 is finished, we'll have a setting to cache certain library bundles, which would let them be reused efficiently in CI. I guess for now I'd say let's just modify A side note, even typechecking base.u is slow, though not as slow as cloning, and it would be nice if we could skip that step too or achieve it faster differently. |
It shows that we can’t pass numbers to `run`. (This also touches more of `all-base-hashes.output.md` than I would have expected, but it does add some definitions to base.u.)
- distinguish between “parameters” and “arguments” – a command has a fixed number of parameters, each of which maps to some number of arguments (from 0 to many, depending on the parameter) - change the type of parameters to eliminate invalid parameter structures - require `InputPattern` parameters to cover all arguments (there are a number of commands whose parameters were under-specified).
This allows us to incrementally expand numbered arguments, only doing so when we want a Unison value and not unstructured text. Fixes unisonweb#2805.
Now that the arguments to `parse` are universally checked, the individual parsers don’t need to handle the cases as precisely.
0365e54
to
421ecc3
Compare
Ok, I updated the new test to not install a library, and instead add a few definitions to base.u. This also fixes a few new/updated commands in the merge to use the new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The printLine output doesn't show up in the transcript output; I forget whether it's expected to? But in any case, is-is it doesn't show what we want. Maybe just return the value instead of printing it? Or does main have to return ()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the run
output doesn’t get included in the transcript output yet. But yeah, I spaced on being able to return the Text
. I’ll fix that. I comforted myself with the fact that the failures were errors, but it still didn’t feel right 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yup.
We should fix #1172 too at some point, but only if it's pretty easy :-\
I could see it getting hairy for more complex handle-manipulation, but maybe it wouldn't?
Overview
There are some commands (like
run
) that don’t want expanded arguments passed to them. E.g.,run main 1
should pass “1” to main, not the numbered result from a previous command.Fixes #2805
Implementation notes
This makes a couple changes. First, it creates a
Parameters
structure that gives a more precise definition of the arguments a command can receive, and eliminates incorrect parameter definitions. It then adds anisStructured
field to theParameterType
(néeArgumentType
) record, which indicates whether arguments to parameters of that type should be parsed & have numbers expanded.One of the complicated bits (as seen in
foldParamsWithM
) is that an “input argument” can be expanded to multiple arguments, and we have to process the arguments left to right, because we don’t know which parameter an argument applies to until after we’ve expanded all the ones ahead of it.Test coverage
This adds a transcript for
run
that shows the new behavior (as best we can without capturingrun
output in transcripts).Loose ends
This is an improved version of the first half of #5480, which also “fixed” #5193. The work here is also progress toward #5193, but the approach in #5480 isn’t great.
The new transcript here also explicitly use
lib.install @unison/base
, despite being in the transcripts-using-base directory, which I would think would make that unnecessary.