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

Generic ZipMatch instances #27

Merged
merged 6 commits into from
Oct 23, 2024
Merged

Generic ZipMatch instances #27

merged 6 commits into from
Oct 23, 2024

Conversation

fizruk
Copy link
Owner

@fizruk fizruk commented Oct 22, 2024

Since ZipMatch in free foil is defined for Bifunctors, regular Generic or Generic1 is not enough. Luckily, kind-generics provide a super-general version called GenericK, which encompasses all other generics, and in particular it covers Generic2, which we'd be interested in.

However, instead of giving a generic implementation for ZipMatch2, we implement a more general case for ZipMatch with arbitrarily many type parameters!

Note that ZipWithK also works for nullary type constructors, which allows specifying whether to compare ground types or not. E.g. we set ZipWithK BNFC'Position to always successfully match, making sure that location does not affect matching of terms.

@fizruk fizruk force-pushed the generic-zip-match branch from 8c54fd7 to 97d7218 Compare October 22, 2024 16:06
@fizruk fizruk merged commit 2c33dd2 into main Oct 23, 2024
4 checks passed
@fizruk fizruk deleted the generic-zip-match branch October 23, 2024 12:59
@fizruk fizruk mentioned this pull request Oct 27, 2024
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.

1 participant