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

Added refine for products and arrows #1416

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft

Added refine for products and arrows #1416

wants to merge 2 commits into from

Conversation

7h3kk1d
Copy link
Contributor

@7h3kk1d 7h3kk1d commented Nov 3, 2024

Screencast.from.2024-11-03.18-11-46.webm

Fills holes of the arrow type with an empty function and product type with an empty tuple. I'm neutral on name but @thomasporter522 had suggested refine since that's what agda uses.

switch (Typ.term_of(Typ.weak_head_normalize(ctx, ana))) {
| Arrow(_, _) => "fun -> "
| Prod(tys) =>
"(" ++ StringUtil.repeat(List.length(tys) - 1, ", ") ++ ") "
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This ends up adding a trailing space but that also seems to happen in the paste case as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't want extra parens if we're inside of a function application but I don't know how much it matters.

@7h3kk1d 7h3kk1d marked this pull request as ready for review November 4, 2024 14:54
@7h3kk1d 7h3kk1d requested a review from cyrus- November 4, 2024 14:55
@disconcision disconcision self-requested a review November 4, 2024 17:28
@cyrus-
Copy link
Member

cyrus- commented Nov 5, 2024

  • let's call it Introduce instead of Refine
  • could also support single-constructor sum types

@cyrus-
Copy link
Member

cyrus- commented Nov 5, 2024

  • also add typfun for polymorphic functions

@cyrus-
Copy link
Member

cyrus- commented Nov 5, 2024

  • don't add extra parens in ap position

@7h3kk1d 7h3kk1d marked this pull request as draft November 19, 2024 19:30
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