Skip to content
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

Cannot launch curried functions via code lenses #224

Open
nickbattle opened this issue Nov 5, 2024 · 2 comments
Open

Cannot launch curried functions via code lenses #224

nickbattle opened this issue Nov 5, 2024 · 2 comments

Comments

@nickbattle
Copy link
Collaborator

If you define a curried function, the code lenses only prompt for the first set of parameters. For example:

functions
	Launch | Debug
	f: real -> real -> nat
	f(a)(b) ==
		1 / a + 1 / b;

This only prompts for a:real, which is "legal" but which naturally only returns the function value:

Default module is DEFAULT
Initialized in ... 0.001 secs.
p f(123)
= (real -> nat)
Executed in 0.005 secs.

It would be more sensible to prompt for all argument sets, and call (say) f(123)(456). This would require a tweak to the code lens configuration to use multiple arrays of "ApplyArgs", much like the underlying explicit function definition. Simple functions and operations would only have one ApplyArgs, of course.

As a workaround, you can edit the launch.json file, but that is unfriendly.

See #188

@nickbattle
Copy link
Collaborator Author

So the code lens data for the example above would look like this:

		"applyArgs":
		[
			[
				{
					"name": "a",
					"type": "real"
				}
			],
			[
				{
					"name": "b",
					"type": "real"
				}
			]
		]

An alternative would be for the code lens to "flatten" the curried argument sets, but then the invocation of f(123)(456) would not know where to put the brackets, in general.

@nickbattle
Copy link
Collaborator Author

@MarkusEllyton If we're working in this area to add "value" presets for counterexample launching, could we add curried parameter sets at the same time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant