Is @ a name-space override, or a visibility override?

Dear all, There is a debate which has been held in our heads for quite some time now. But we’ve never really had the conversation. This debate has been raised again in the context of proposal #281. But I’d rather make a separate thread about it. The question is the following: When I write f @t Am I using @ as a way to change an invisible argument into a visible argument? Or am I using @ to insert a type expression into a term expression? ------------------------------ The truth is that it’s doing both at the same time. So some of us have taken to believing that the One True Meaning™ of @ is to override (in)visibility. While others have taken to believing that the One True Meaning™ of @ is to insert types in term. And, in both cases, we believe the other part to be incidental. In favour of types-in-term, there is the pretty-printer for Core, which, if I’m not mistaken, uses @t to denote type applications (and all type applications are visible in Core, so there is no visibility override to be had). Whatever we think about this, it appears that the fact that this meaning ascription is implicit has caused some anguish. So I think that we should have this discussion explicitly for once. I chose to do so in a different thread than the #281 discussion, because this discussion stands on its own. Anyway, the floor is yours. /Arnaud

I've always been somewhat confused by the visible/invisible distinction, so I guess @ is a namespace override in my mind. There's another aspect of confusion around @ that came up in proposal #291, which Simon just brought up again. Is @ syntax for application or binding? Originally it was just application, then I believe we allowed it to bind existentials alone, and now there's work underway to allow it to bind any type variable in patterns. But reusing the same syntax for application and binding raises hairy questions like the one we're facing now in #291. On Fri, Nov 13, 2020, at 09:10, Spiwack, Arnaud wrote:
Dear all,
There is a debate which has been held in our heads for quite some time now. But we’ve never really had the conversation. This debate has been raised again in the context of proposal #281. But I’d rather make a separate thread about it.
The question is the following:
When I write
`f @t ` Am I using `@` as a way to change an invisible argument into a visible argument? Or am I using `@` to insert a type expression into a term expression?
The truth is that it’s doing both at the same time. So some of us have taken to believing that the One True Meaning™ of `@` is to override (in)visibility. While others have taken to believing that the One True Meaning™ of `@` is to insert types in term.
And, in both cases, we believe the other part to be incidental.
In favour of types-in-term, there is the pretty-printer for Core, which, if I’m not mistaken, uses `@t` to denote type applications (and all type applications are visible in Core, so there is no visibility override to be had).
Whatever we think about this, it appears that the fact that this meaning ascription is implicit has caused some anguish. So I think that we should have this discussion explicitly for once.
I chose to do so in a different thread than the #281 discussion, because this discussion stands on its own.
Anyway, the floor is yours.
/Arnaud
_______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.org https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee

Hello, I believe the current design is that `@` is an application for providing "inferred" arguments (i.e., arguments that could be omitted but for whatever reason the user wants to provide explicitly). I don't really think of it in that way when I use it, and I don't think I am alone in that. This is why I wrote the following in the comments for #281: Imagine a system (different from what we have now) built out of the following components: The usual "empty space" operator means "I am applying a required argument". There is a different operator, say (`) for applying an inferred argument The prefix @ means "now I am writing an expression in the language above. In the case of values "above" means type, in the case of types, "above" would be kinds (or with TypeInType there would be no language "above" types). Here are some examples: Normal application is just like now: f x Applying a required type parameter: f @x Applying an inferred type parameter: f `@x We don't have inferred value parameters (dictionaries?), but if we did, we could apply them like this: f `x The same system can be extended with dependent types by adding a symbol to indicate "the language bellow", for example: The prefix ' means "now I am writing a term in the language below" This allows us to write dependent types like this: Here is a type that depends on a value: T '[1,2,3] This is not a design I've fully worked out, but is roughly how I think when I program. -Iavor

This might be relevant to this discussion. Richard Eisenberg has opened a
proposal to give a “general steering” towards Dependent Haskell, or not.
- Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/378
- Reddit:
https://www.reddit.com/r/haskell/comments/jtvf06/should_ghc_support_ergonomi...
I think it’s also a place where we all should express our opinion.
Alejandro
On 13 Nov 2020 at 16:51:58, Iavor Diatchki
_______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.org https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee

Yes -- apologies for not posting to this list last night, but I was eager to get my proposal out the door while it was topical... and then eager to get to bed once it had. That proposal (https://github.com/ghc-proposals/ghc-proposals/pull/378) is, in a sense, a generalization of this thread (thanks, Arnaud for starting it). To Iavor's email: I think the design you describe makes good sense, but only for a language without dependent types. A language with dependent types could be imagined with "languages above" and "languages below", but I think the "above"/"below" switching would introduce friction with little self-sustaining benefit. By "self-sustaining" there, I mean that a dependently typed language often has no need for different languages above or below, and so making that distinction in a dependently typed language is awkward. However, one could imagine a dependently typed Haskell that retains the distinction, essentially for philosophical backward compatibility. ("Philosophical" because I believe we can design dependent types in Haskell to be fully backward compatible, but it might require a new way of thinking about what phrases in the language mean.) Perhaps even more directly, avoiding a distinction between languages above/below is a key component of what I require in an ergonomic interpretation of dependent types. Keeping the distinction would, unless I'm convinced otherwise, appear un-ergonomic. Richard
On Nov 14, 2020, at 7:21 AM, Alejandro Serrano Mena
wrote: This might be relevant to this discussion. Richard Eisenberg has opened a proposal to give a “general steering” towards Dependent Haskell, or not. - Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/378 https://github.com/ghc-proposals/ghc-proposals/pull/378 - Reddit: https://www.reddit.com/r/haskell/comments/jtvf06/should_ghc_support_ergonomi... https://www.reddit.com/r/haskell/comments/jtvf06/should_ghc_support_ergonomi...
I think it’s also a place where we all should express our opinion.
Alejandro
On 13 Nov 2020 at 16:51:58, Iavor Diatchki
mailto:iavor.diatchki@gmail.com> wrote: _______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.org mailto:ghc-steering-committee@haskell.org https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee _______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.org https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee

I haven't followed this debate, but the main question I have is: what are
the implications of choosing one view over the other?
Cheers
SImon
On Fri, 13 Nov 2020 at 14:10, Spiwack, Arnaud
Dear all,
There is a debate which has been held in our heads for quite some time now. But we’ve never really had the conversation. This debate has been raised again in the context of proposal #281. But I’d rather make a separate thread about it.
The question is the following:
When I write
f @t
Am I using @ as a way to change an invisible argument into a visible argument? Or am I using @ to insert a type expression into a term expression? ------------------------------
The truth is that it’s doing both at the same time. So some of us have taken to believing that the One True Meaning™ of @ is to override (in)visibility. While others have taken to believing that the One True Meaning™ of @ is to insert types in term.
And, in both cases, we believe the other part to be incidental.
In favour of types-in-term, there is the pretty-printer for Core, which, if I’m not mistaken, uses @t to denote type applications (and all type applications are visible in Core, so there is no visibility override to be had).
Whatever we think about this, it appears that the fact that this meaning ascription is implicit has caused some anguish. So I think that we should have this discussion explicitly for once.
I chose to do so in a different thread than the #281 discussion, because this discussion stands on its own.
Anyway, the floor is yours.
/Arnaud _______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.org https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee
participants (6)
-
Alejandro Serrano Mena
-
Eric Seidel
-
Iavor Diatchki
-
Richard Eisenberg
-
Simon Marlow
-
Spiwack, Arnaud