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

Partial record type? #702

Closed
weaversa opened this issue May 6, 2020 · 3 comments
Closed

Partial record type? #702

weaversa opened this issue May 6, 2020 · 3 comments
Labels
type: question Issues that are primarily asking questions wontfix Closed issues that we decided not to fix, but are still potentially relevant

Comments

@weaversa
Copy link
Contributor

weaversa commented May 6, 2020

Is it possible to specify a partial record type?

For example:

let f (x : {a : SetupValue, ...}) = ...

What if I just want to match on any record that includes a field named a of type SetupValue?

@weaversa weaversa added the type: question Issues that are primarily asking questions label May 6, 2020
@weaversa
Copy link
Contributor Author

weaversa commented May 6, 2020

Here's a more concrete example showing what I'd like to do. to_cryptol should take a list of values with t fields of type Term and return a list of the terms.

let pull_term (x : a) = do {
  return (x.t : Term);
};

let to_cryptol (x : [a]) = do {
  let ret = for x pull_term;
  return (ret : [Term]);
};

Here saw complains:

Record lookup on non-record argument.
Field name: t

@weaversa weaversa closed this as completed May 6, 2020
@weaversa weaversa reopened this May 6, 2020
@weaversa
Copy link
Contributor Author

weaversa commented May 8, 2020

Maybe asking for 'shape' polymorphism on records is too much?

@atomb atomb added the wontfix Closed issues that we decided not to fix, but are still potentially relevant label May 15, 2020
@atomb
Copy link
Contributor

atomb commented May 15, 2020

This sort of thing will become much easier using the Python interface. This would be a lot of effort to put into extending the language in ways we probably won't use in the long run.

@atomb atomb closed this as completed May 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Issues that are primarily asking questions wontfix Closed issues that we decided not to fix, but are still potentially relevant
Projects
None yet
Development

No branches or pull requests

2 participants