[ghc-steering-committee] Is @ a name-space override, or a visibility override?
Iavor Diatchki
iavor.diatchki at gmail.com
Fri Nov 13 15:51:58 UTC 2020
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-steering-committee/attachments/20201113/33fc254d/attachment.html>
More information about the ghc-steering-committee
mailing list