-
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
Support promoting/singling namespace specifiers in fixity declarations #582
Labels
Comments
RyanGlScott
added a commit
that referenced
this issue
May 1, 2024
This bumps the `th-desugar` commit in the `cabal.project` file's `source-repository-package` to bring in the changes from `th-desugar-1.17`. Among other things, this version of `th-desugar` adds support for: * Namespace specifiers in fixity declarations * Embedded type expressions and patterns * Invisible type patterns For now, `singletons-th` will error if it encounters any of these constructs. Where appropriate, I have opened issues to track the idea of supporting these language features in `singletons-th`: * For namespace specifiers in fixity declarations, see #582. * Supporting embedded type expressions and patterns seems quite difficult due to `singletons-th`'s policy of only promoting/singling vanilla type signatures (see the `README`), so I have not opened an issue for this. * For invisible type patterns, see #583. This is one step towards preparing a GHC 9.10–compatible release of `singletons` and friends (see #569).
RyanGlScott
added a commit
that referenced
this issue
May 1, 2024
This bumps the `th-desugar` commit in the `cabal.project` file's `source-repository-package` to bring in the changes from `th-desugar-1.17`. Among other things, this version of `th-desugar` adds support for: * Namespace specifiers in fixity declarations * Embedded type expressions and patterns * Invisible type patterns For now, `singletons-th` will error if it encounters any of these constructs. Where appropriate, I have opened issues to track the idea of supporting these language features in `singletons-th`: * For namespace specifiers in fixity declarations, see #582. * Supporting embedded type expressions and patterns seems quite difficult due to `singletons-th`'s policy of only promoting/singling vanilla type signatures (see the `README`), so I have not opened an issue for this. * For invisible type patterns, see #583. This is one step towards preparing a GHC 9.10–compatible release of `singletons` and friends (see #569).
RyanGlScott
added a commit
that referenced
this issue
May 1, 2024
This bumps the `th-desugar` commit in the `cabal.project` file's `source-repository-package` to bring in the changes from `th-desugar-1.17`. Among other things, this version of `th-desugar` adds support for: * Namespace specifiers in fixity declarations * Embedded type expressions and patterns * Invisible type patterns For now, `singletons-th` will error if it encounters any of these constructs. Where appropriate, I have opened issues to track the idea of supporting these language features in `singletons-th`: * For namespace specifiers in fixity declarations, see #582. * Supporting embedded type expressions and patterns seems quite difficult due to `singletons-th`'s policy of only promoting/singling vanilla type signatures (see the `README`), so I have not opened an issue for this. * For invisible type patterns, see #583. This is one step towards preparing a GHC 9.10–compatible release of `singletons` and friends (see #569).
What's the reason to put fixity on defunctionalization symbols? Their arity generally differs from the original construct (and so their infix usage is likely quite different-looking). And programmatically generated uses won't care about the fixity. Otherwise, this sounds great to me. |
Ah right. Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
GHC 9.10.1 adds support for namespaces in fixity declarations, e.g.,
It would be nice if
singletons-th
could take these into account during promotion and singling. In particular, we could promotef
to:And we could single
f
to:Some wrinkles to this plan:
What happens if we promote or single a quoted type-level declaration, such as this one?
In that case, we would simply return the original fixity declaration unchanged (including the
type
specifier).In the event that a fixity declaration lacks an explicit namespace specifier, I propose that we promote/single it to something that does have an explicit namespace specifier. To see why, consider this example:
We must not promote this to the following:
If we did, there would be two clashing fixity declarations for
(###)
: one for the name in thedata
namespace, and another for the name in thetype
namespace. We should instead promote(###)
to the following to avoid the risk of name clashes:If we did this, then we can remove a hack from
singletons-th
that is described inWrinkle 1: When not to promote/single fixity declarations
ofNote [singletons-th and fixity declarations]
.The text was updated successfully, but these errors were encountered: