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

adding array constructor to subsumption rule #1991

Merged
merged 3 commits into from
Jul 17, 2024

Conversation

Eckaos
Copy link
Contributor

@Eckaos Eckaos commented Jul 8, 2024

No description provided.

@Eckaos Eckaos marked this pull request as ready for review July 11, 2024 14:39
Copy link
Member

@yannham yannham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, we don't add covariance of record types in this PR. This is fine, this makes it smaller and we can leave record types for a follow up. However, it's best to add some tests to check array covariance.

@Eckaos Eckaos changed the title adding constructors to subsumption rule adding array constructor to subsumption rule Jul 16, 2024
@yannham
Copy link
Member

yannham commented Jul 17, 2024

@Eckaos the test isn't really testing what you tink, I fear. The application isn't under a type annotation, so it's not typechecked. The simplest is to just put everything under a type annotation, for example:

let numbers : Array Number = 
  let array_of_records = [{foo = 1}, {foo = 2}, {foo = 3}] in
  let extract_numbers : Array {_ : Number} -> Array Number = fun dicts =>
    dicts
    |> std.array.map std.record.to_array
    |> std.array.flatten
    |> std.array.map (fun { field, value } => value)
  in
  extract_numbers array_of_records
in
numbers == [1, 2, 3]

Copy link
Member

@yannham yannham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now!

@yannham yannham added this pull request to the merge queue Jul 17, 2024
Merged via the queue into tweag:master with commit ffa5565 Jul 17, 2024
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants