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 type applications to specify type of SPECIALISE pragma #15
Conversation
|
||
bndr: (a Haskell value-level binder) | ||
tybndr: (a Haskell type-level binder) | ||
type: (A Haskell type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly it seems that the .. productionlist
directive isn't recognized by GitHub's renderer.
85c220f
to
0073202
Compare
#-} | ||
|
||
This is, of course, quite a mouthful! Moreover, if we would at some point like | ||
to change the type of ``foldWithParser``, we would need to updae each of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updae
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
which can then be used to fill in the type arguments of a function which we'd | ||
like to quantify over, :: | ||
|
||
{-# SPECIALISE forall m. foldsAndParser @m @() #-} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we write
foo :: forall a b. (Ord a, Ord b) => Foo a -> Bar b
{-# SPECIALISE forall a. foo @a @a #-}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I believe that should be fine. The only question is whether we want to allow the introduction of new constraints, I believe. That being said, I haven't thought terribly hard about what subtleties the forall
syntax might introduce.
I think @phadej 's |
I might be jumping the gun on https://ghc.haskell.org/trac/ghc/ticket/11350, but doesn't {-# SPECIALISE \@m -> foldsAndParser @m @() #-} make more sense? (i.e. [capital] Lambda instead of forall) |
John Ericson notifications@github.com writes:
|
Proposed syntax | ||
~~~~~~~~~~~~~~~ | ||
|
||
The syntax of ``SPECIALISE`` would become, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this sentence is incomplete -- unfinished section?
This seems like an interesting proposal. My only concern is this: are specialize pragmas used widely enough, in enough places by enough people, to warrant this improvement in concision? The counterargument to this objection, IMHO, is that making a little-used feature more complicated only affects users of that feature. People who never write specialize pragmas shouldn't need to know whether this proposal is accepted or not.... |
Not much happening here recently. Is this soon going to be put up for discussion, Ben? |
We should carefully consider how this interacts with the idea of value argument specialization, which I know has been discussed somewhere (i.e., specializing to the case where the function is applied to a particular argument). Explicit type lambdas seem to make sense in that regard. |
Due to lack of activity, I am marking this proposal as dormant. |
This has been dormant for a long time. @bgamari, is this abandonned? In that case, please consider closing it. |
Closing due to inactivity, but it can of course be reactivated any time. |
This would come in handy in the presence of AllowAmbiguousTypes extension.
Using Proxy/Proxy# is a workaround. |
Heh, I just found myself in a situation editing big |
I think this would be a nice quality of life improvement and it is worth re-visiting. |
I'd also love to see this. Particularly with big
EDIT: Appears to be a special case of #493 ? |
This describes an extension to the syntax of
SPECIALISABLE
pragmas, allowing use of type applications instead of an explicit type signature for specifying the specialised type.Rendered