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
Embrace (Type :: Type) #83
Conversation
Do you mean that it is a synonym for the |
No. I think There was a typo on this line; fixed now. |
If we are going to be removing |
But |
Indeed, we are going to be breaking a fair bit of code regardless of which choice we make. I suppose we'd have to weigh the cost of avoiding having to import |
I think tying the question of |
Can you clarify? I would hope we'd allow forall (n :: Int#) but what about forall (b :: 'True)
forall (x :: Maybe) |
Here's my suggestion for Step 1
Step 2
Once these steps are complete, the parsing of |
Tying (One alternative to getting rid of As to assumptions around the kind of a type variable: pre-GHC8, if you had |
@goldfirere wrote:
I'm sure it does! But I conjecture that the vast majority of that pain comes from having to figure out whether |
Compelling argument. Yes, I agree that if So, may I understand your proposal this way:
If this is correct, then the difficult migration is incurred only by modules with |
Hear, hear.
More like twenty or thirty years; as in after I've hung up my coding pencil. For students/people wanting to learn functional programming and practical type systems, what language would you recommend these days? The Haskell by which I learned to love FP seems to be turning into some bloated, barely-recognisable hieroglyphics. "Like a monstrous carbuncle on an old friend." |
So, may I understand your proposal this way:
- With -XNoTypeOperators, * works as it always has -- it's always in
scope and it parses just like alphanumeric identifiers.
- With -XTypeOperators, it is utterly impossible to refer to * by that
name. (Of course, you can still use Type.)
Exactly.
|
Haskell, of course. Since my time in this playground, the only changes that would affect beginners have been the changes to |
(Sidenote: Isn't this proposal process lovely? I can't tell you how many hours I spent agonizing over what to do about |
The purpose of my proposed TypeColonOperators would be to allow code that
only makes "light" use of type operators to continue to use *. This should
save considerable time updating what I suspect is a rather large number of
modules in the wild, thanks to Data.Type.Equality and GHC.Generics.
|
Actually, I just had a better idea. Add an option StarIsType. Turn it on by
default when TypeOperators are disabled, and off by default when they're
enabled. Now everything compiles with either StarIsType or NoStarIsType.
Simple!
…On Oct 18, 2017 5:35 PM, "David Feuer" ***@***.***> wrote:
The purpose of my proposed TypeColonOperators would be to allow code that
only makes "light" use of type operators to continue to use *. This should
save considerable time updating what I suspect is a rather large number of
modules in the wild, thanks to Data.Type.Equality and GHC.Generics.
|
Oh, we always had ways to bikeshed over lexical syntax. ;-) I well remember when even so great a personage as SPJ proposed a change to one of the symbols that had been in Haskell since forever. ('The power of the dot.') There were long and vehement howls of outrage. (In fact I'm wondering where all those people have gone.) Arguably using dot for compose should never have happened. (Functional notation uses that ringy thing.) And personally I thought the proposal made a lot of sense; but there was the same riposte as here: breaking code and printed resources. (And for that educational reason, I agree with what you didn't say about the FTP change: it's been cited again this week as a reason against using Haskell in education.) But |
Perhaps it's because my math background is surprisingly absent (now having earned my doctorate and gotten a job, I can admit the first college-level-or-above math class I've been associated with is the one I'm teaching at the moment!), but I've never seen Returning to @treeowl's idea: What would the parser do with |
Easy! In that case, * is Type and cannot be used as a type operator!
…On Oct 18, 2017 9:45 PM, "Richard Eisenberg" ***@***.***> wrote:
Perhaps it's because my math background is surprisingly absent (now having
earned my doctorate and gotten a job, I can admit the first
college-level-or-above math class I've been associated with is the one I'm
teaching at the moment!), but I've never seen * used in a way to denote a
function's arity.
Returning to @treeowl <https://github.com/treeowl>'s idea: What would the
parser do with -XTypeOperators -XStarIsType? Or would that just be an
immediate error? (I think it would have to be.)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#83 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABzi_Q86KMJxBNbdnJmofw4yxQGYgQSZks5stqm6gaJpZM4P94kf>
.
|
Alternatively, * is Type except when fully qualified, as in GHC.TypeLits.*,
in which case Data.Kind.* is just not found.
…On Oct 18, 2017 10:29 PM, "David Feuer" ***@***.***> wrote:
Easy! In that case, * is Type and cannot be used as a type operator!
On Oct 18, 2017 9:45 PM, "Richard Eisenberg" ***@***.***>
wrote:
> Perhaps it's because my math background is surprisingly absent (now
> having earned my doctorate and gotten a job, I can admit the first
> college-level-or-above math class I've been associated with is the one I'm
> teaching at the moment!), but I've never seen * used in a way to denote
> a function's arity.
>
> Returning to @treeowl <https://github.com/treeowl>'s idea: What would
> the parser do with -XTypeOperators -XStarIsType? Or would that just be
> an immediate error? (I think it would have to be.)
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#83 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABzi_Q86KMJxBNbdnJmofw4yxQGYgQSZks5stqm6gaJpZM4P94kf>
> .
>
|
Until you import some library that uses them; you don't have that extension switched on in your own code; but you make a small mistake in how you use the library; then you get an avalanche of higher-typed error messages, with type signatures containing things that don't even look like types. Or even you make a small typo in writing a signature, and rather than GHC helpfully saying it's mal-formed, you get "Perhaps you intended to us I'm glad to see @treeowl is talking some sense. If
|
I like @treeowl's suggestion to decouple the |
I just typed in |
Ah, I was confused by the following GHCi session:
Apparently GHC does some sort of disambiguation based on whether ★ is applied to type parameters? |
Not sure, to be honest (though I can replicate your experience). It has something to do with the hackery around parsing |
I think a better plan is to have no special case rules in the lexer, and instead advocate the use of |
There is reason to treat them differently:
I insist that we want a one-character shorthand for |
In anticipation of ghc-proposals/ghc-proposals#83 being implemented one day.
Despite having submitted this to the committee already, I added one last alternative that just occurred to me: use |
Why not just put |
@vagarenko, see the series of comments starting at #83 (comment). Exporting |
It seems a little strange to make a keyword for a thing that is not a primitive.
|
I've retracted my |
Currently, the proposal states:
I assume this is referring to #103? |
It looks like I'm late to the party but I'd certainly like to be on record and preferring having The most common kinds are going to continue to be constructed from The I'm opposed to clever Unicode-based replacements for |
I think we all agree that we should collapse -XPolyKinds and -XTypeInType. The only issue is what to do about *. No solution is perfect: let's get this decided! The status quo is terrible!
That is, the meaning of '*' depends both on the extension flags -- and moreover on a flag whose primary purpose is quite separate -- AND depends (in some cases) on lexical scope or (in other cases) on syntactic context. This is a ridiculous design. The simplest thing to do is to say
That is simple and explicable. Moreover the on-by-default rule means that most existing prams that use PolyKinds will continue to work unchanged. In effect -XStarIsType is roughly the delta between -XPolyKinds and -XTypeInType. Once that is in place we can think about future policy. For example
But let's get this done, one way or another. |
The proposal has been accepted; the following discussion is mostly of historic interest.
This proposal expands the meaning of
-XPolyKinds
to include-XTypeInType
, deprecates-XTypeInType
, and advocates for usingType
in place of*
.Rendered