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

Type applications break function matching #27

Open
ilyakooo0 opened this issue Jun 26, 2021 · 3 comments
Open

Type applications break function matching #27

ilyakooo0 opened this issue Jun 26, 2021 · 3 comments

Comments

@ilyakooo0
Copy link

running the rule

forall a b. foo a b = foo b a

on the following file would succeed:

main = foo x y

while adding type applications to a function call would break matching the function and the rewrite would not be applied:

main = foo @Int x y
@xich
Copy link
Contributor

xich commented Jun 27, 2021

Matching is syntactic, so this is expected. Does the rule forall t a b. foo @t a b = foo @t b a work? (@ not strictly necessary, but would distinguish from a term-level variable)

I'm not sure how we could spot this is the general case since we don't have access to the type of foo (retrie only parses).

@ilyakooo0
Copy link
Author

No, it would not work. Type applications are not supported at all in rules. It will give an error.

@ilyakooo0
Copy link
Author

I think ignoring type applications when matching would be far preferable to not matching at all. Right now if the codebase supports type applications, there is no reliable way of applying a rule to the codebase.

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

2 participants