-
Notifications
You must be signed in to change notification settings - Fork 36
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
Allow promoting and singling of visible type applications in data constructor patterns #489
Labels
Comments
RyanGlScott
added a commit
that referenced
this issue
Sep 25, 2021
While supporting visible type applications in their full generality is challenging, type applications in data constructor patterns are a very well behaved subset, which makes it quite feasible to support in `singletons-th`. This patch accomplishes just that. We also make an effort to distinguish between wildcard types found in type applications in data constructor, which we can support, and other wildcard types, which we cannot yet support due to GHC restrictions about using wildcard types in kind-level contexts. I have added a section to the `README` to explain this distinction. Fixes #489.
RyanGlScott
added a commit
that referenced
this issue
Sep 26, 2021
While supporting visible type applications in their full generality is challenging, type applications in data constructor patterns are a very well behaved subset, which makes it quite feasible to support in `singletons-th`. This patch accomplishes just that. We also make an effort to distinguish between wildcard types found in type applications in data constructor, which we can support, and other wildcard types, which we cannot yet support due to GHC restrictions about using wildcard types in kind-level contexts. I have added a section to the `README` to explain this distinction. Fixes #489.
RyanGlScott
added a commit
that referenced
this issue
Sep 26, 2021
While supporting visible type applications in their full generality is challenging, type applications in data constructor patterns are a very well behaved subset, which makes it quite feasible to support in `singletons-th`. This patch accomplishes just that. We also make an effort to distinguish between wildcard types found in type applications in data constructor, which we can support, and other wildcard types, which we cannot yet support due to GHC restrictions about using wildcard types in kind-level contexts. I have added a section to the `README` to explain this distinction. Fixes #489.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
GHC 9.2 introduces the ability to have visible type applications in data constructor patterns like so:
Can we promote and single such a definition in
singletons
? While supporting visible type applications in their full generality insingletons
is challenging (see #378), visible type applications in data constructor patterns are a relatively self-contained, well behaved part ofTypeApplications
. This is becausesingletons
can reliably guarantee that promoted and singled data constructors will have the same behavior vis-à-vis visible type applications as their term-level counterparts (see #408), which means that as long as we restrict ourselves to data constructors, theTypeApplications
-related issues mentioned in #378 shouldn't arise.Here is a first attempt at implementing this:
This suffices to allow the
blah
function above to be promoted and singled. There's one remaining issue left to fix: wildcard patterns. If you have this program:Then it will fail like so:
See #480.
The text was updated successfully, but these errors were encountered: