<div dir="ltr">From the GitHub discussions and the e-mails, I've seen a couple of other options being proposed/discussed:<div><br></div><div> * Use a unicode star operator.</div><div> - Pros: short, looks like the current star, much less likely to clash with stuff.</div><div> - Cons: typing a unicode symbol in some editors could be a pain.</div><div><br></div><div> * Continue using `*` (or another infix operator), but require that it be written in prefix notation, i.e. write `(*)` instead of `*`.</div><div> - Pros: less of a wart, follows normal language rules</div><div> - Cons: it is odd to use an infix operator that is not binary (i.e., can't be written infix); still uses up the `*` name</div><div><br></div><div> * Continue using `*` but---at the type level---have it always refer to the kind, when used unqualified. This is what is called `StartIsKind` in the proposal.</div><div><br></div><div><br></div><div>On Wed, Feb 21, 2018 at 7:59 AM Simon Peyton Jones <<a href="mailto:simonpj@microsoft.com">simonpj@microsoft.com</a>> wrote:<br></div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-GB" link="blue" vlink="purple">
<div class="m_-7803890041941884785WordSection1">
<p class="MsoNormal"><span>The issue about ‘*’ seems to be this<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<ul style="margin-top:0cm" type="disc">
<li class="m_-7803890041941884785MsoListParagraph" style="margin-left:0cm"><span>We need a way to write down the kind of types. E.g. Int :: ???<u></u><u></u></span></li></ul>
<p class="m_-7803890041941884785MsoListParagraph"><span>What is the “???”<u></u><u></u></span></p>
<p class="m_-7803890041941884785MsoListParagraph"><span><u></u> <u></u></span></p>
<p class="m_-7803890041941884785MsoListParagraph" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:36.0pt">
<u></u><span style="font-family:Symbol"><span>·<span style="font:7.0pt "Times New Roman"">
</span></span></span><u></u><span>There are several possibilities<u></u><u></u></span></p>
<p class="m_-7803890041941884785MsoListParagraph" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:72.0pt">
<u></u><span><span>1.<span style="font:7.0pt "Times New Roman"">
</span></span></span><u></u><span>Continue to use * as
<b>built in syntax. </b>It’s a massive wart; you can’t write (*->*) because GHC thinks that’s a single lexeme; and * is a terrifically useful infix operator, so stealing it is horrible. I’m sure we would never do this today.<u></u><u></u></span></p>
<p class="m_-7803890041941884785MsoListParagraph" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:72.0pt">
<u></u><span><span>2.<span style="font:7.0pt "Times New Roman"">
</span></span></span><u></u><span>Import a module Data.Type to bring Type into scope using the
<b>normal module scoping mechanism</b>. <u></u><u></u></span></p>
<ul style="margin-top:0cm" type="disc">
<ol style="margin-top:0cm" start="2" type="1">
<ul style="margin-top:0cm" type="square">
<li class="m_-7803890041941884785MsoListParagraph" style="margin-top:6.0pt;margin-bottom:6.0pt;margin-left:0cm">
<span>Advantage: no new special things<u></u><u></u></span></li><li class="m_-7803890041941884785MsoListParagraph" style="margin-top:6.0pt;margin-bottom:6.0pt;margin-left:0cm">
<span>Disadvantage: an extra import; and error messages might say Data.Type.Type fully qualified if you didn’t have the import.<u></u><u></u></span></li></ul>
</ol>
</ul>
<p class="m_-7803890041941884785MsoListParagraph" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:72.0pt">
<u></u><span><span>3.<span style="font:7.0pt "Times New Roman"">
</span></span></span><u></u><span>Same, but export Type from Prelude.
<u></u><u></u></span></p>
<ul style="margin-top:0cm" type="disc">
<ol style="margin-top:0cm" start="3" type="1">
<ul style="margin-top:0cm" type="square">
<li class="m_-7803890041941884785MsoListParagraph" style="margin-top:6.0pt;margin-bottom:6.0pt;margin-left:0cm">
<span>Advantage: no need for that special import<u></u><u></u></span></li><li class="m_-7803890041941884785MsoListParagraph" style="margin-top:6.0pt;margin-bottom:6.0pt;margin-left:0cm">
<span>Disadvantage: would break existing programs that define Type, and import Prelude, regardless of flags.<u></u><u></u></span></li></ul>
</ol>
</ul>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:90.0pt">
<span>I suppose we could say that you only get Type from Prelude if -XTypeInType is also on, but that IS new (and ad hoc) mechanism.<u></u><u></u></span></p>
<p class="m_-7803890041941884785MsoListParagraph" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:72.0pt">
<u></u><span><span>4.<span style="font:7.0pt "Times New Roman"">
</span></span></span><u></u><span>Define Type as a new
<b>keyword</b> (with TypeInType). It does not need to be imported; it cannot be overridden or redefined. (Just like (->).)
<u></u><u></u></span></p>
<ul style="margin-top:0cm" type="disc">
<ol style="margin-top:0cm" start="4" type="1">
<ul style="margin-top:0cm" type="square">
<li class="m_-7803890041941884785MsoListParagraph" style="margin-top:6.0pt;margin-bottom:6.0pt;margin-left:0cm">
<span>A variant of this (which I quite like) is to use the existing keyword
<b>type</b> (lowercase).<u></u><u></u></span></li><li class="m_-7803890041941884785MsoListParagraph" style="margin-top:6.0pt;margin-bottom:6.0pt;margin-left:0cm">
<span>Advantage: simple clear story<u></u><u></u></span></li><li class="m_-7803890041941884785MsoListParagraph" style="margin-top:6.0pt;margin-bottom:6.0pt;margin-left:0cm">
<span>Note: won’t break existing code; only code that says TypeInType<u></u><u></u></span></li></ul>
</ol>
</ul>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<span>Is that a fair summary of the design space?<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<span>Simon<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<span><u></u> <u></u></span></p>
<p class="MsoNormal"><a name="m_-7803890041941884785__MailEndCompose"><span><u></u> <u></u></span></a></p>
<span></span>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Iavor Diatchki [mailto:<a href="mailto:iavor.diatchki@gmail.com" target="_blank">iavor.diatchki@gmail.com</a>]
<br></span></p></div></div></div></div></div><div lang="EN-GB" link="blue" vlink="purple"><div class="m_-7803890041941884785WordSection1"><div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt"><div><div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><span lang="EN-US">
<b>Sent:</b> 09 February 2018 17:47<br>
<b>To:</b> Simon Peyton Jones <<a href="mailto:simonpj@microsoft.com" target="_blank">simonpj@microsoft.com</a>><br>
</span></p></div></div></div></div></div><div lang="EN-GB" link="blue" vlink="purple"><div class="m_-7803890041941884785WordSection1"><div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt"><div><div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><span lang="EN-US"><b>Cc:</b> Richard Eisenberg <<a href="mailto:rae@cs.brynmawr.edu" target="_blank">rae@cs.brynmawr.edu</a>>; <a href="mailto:ghc-steering-committee@haskell.org" target="_blank">ghc-steering-committee@haskell.org</a>; Joachim Breitner <<a href="mailto:mail@joachim-breitner.de" target="_blank">mail@joachim-breitner.de</a>></span></p></div></div></div></div></div><div lang="EN-GB" link="blue" vlink="purple"><div class="m_-7803890041941884785WordSection1"><div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt"><div><div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><span lang="EN-US"><br>
<b>Subject:</b> Re: [ghc-steering-committee] Proposal: Embrace Type in Type<u></u><u></u></span></p></div></div></div></div></div><div lang="EN-GB" link="blue" vlink="purple"><div class="m_-7803890041941884785WordSection1"><div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
The issue I see is that it is quite common to get a kind error without doing any fancy type level programming---in particular without writing kind signatures or anything like that. So you'd have no reason to import `Data.Kind(Type)`. The result would be
that GHC would give quite a verbose error message, using the fully qualified name of `Type`. Unless we did something special.<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
-Iavor<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<u></u> <u></u></p>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
On Fri, Feb 9, 2018 at 2:41 AM Simon Peyton Jones <<a href="mailto:simonpj@microsoft.com" target="_blank">simonpj@microsoft.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">I’m not sure I see the problem here. If ‘Int’ is not in scope then</span><u></u><u></u></p>
<p class="MsoNormal" style="text-indent:5.25pt">
<span style="font-size:12.0pt">f :: Int -> Int</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:12.0pt">won’t work. What’s different about ‘Type’</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:12.0pt"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:12.0pt">Simon</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:12.0pt"> </span><u></u><u></u></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> ghc-steering-committee [mailto:<a href="mailto:ghc-steering-committee-bounces@haskell.org" target="_blank">ghc-steering-committee-bounces@haskell.org</a>]
<b>On Behalf Of </b>Richard Eisenberg<br>
<b>Sent:</b> 09 February 2018 04:26<br>
<b>To:</b> Iavor Diatchki <<a href="mailto:iavor.diatchki@gmail.com" target="_blank">iavor.diatchki@gmail.com</a>><br>
<b>Cc:</b> <a href="mailto:ghc-steering-committee@haskell.org" target="_blank">ghc-steering-committee@haskell.org</a>; Joachim Breitner <<a href="mailto:mail@joachim-breitner.de" target="_blank">mail@joachim-breitner.de</a>><br>
<b>Subject:</b> Re: [ghc-steering-committee] Proposal: Embrace Type in Type</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Thanks, Iavor, for bringing this up.<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">To clarify the proposal: -XStarIsType is orthogonal to deprecation. The extension is necessary in order to continue to parse existing programs, but if we choose to deprecate *,
then we would deprecate even with -XStarIsType is enabled (precisely to avoid the half-deprecation scenario Iavor is worried about).<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I envisioned always printing Type unqualified in error messages, even if it's not imported. If a user writes Type and it's out of scope, we could always have a special-case check
suggesting they import Data.Kind. I won't argue this is a principled design, though, and is likely a poor choice if some other Type is in scope.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">The truth is that I don't have a great way forward here (and haven't for years) and am very hopeful someone on this list can come up with one! :) The proposal has my best idea,
but I'm still not thrilled with it.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Richard<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On Feb 8, 2018, at 1:46 PM, Iavor Diatchki <<a href="mailto:iavor.diatchki@gmail.com" target="_blank">iavor.diatchki@gmail.com</a>> wrote:<u></u><u></u></p>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<div>
<p class="MsoNormal">Hello,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I didn't see any discussion about the third part of this proposal, namely the addition of a new extension called `StarIsKind`. The idea is that when this is on, `*` will still
be treated as a special alpha-numeric name, and it will *always* refer to the kind of inhabited types (i.e., same as know). The difference is that it cannot be used as another type-level operator (e.g., for multiplication).<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Presumably, when this extension is on, there would be no deprecation warning emitted for `*`? We should clarify this in the proposal.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I am not certain if this is a good idea. It makes the use of `*` sort of "half" deprecated, and leaves us with multiple "standard" ways to refer to the same thing (e.g., in type
errors). Also, if we want people to update their code to use `Type` instead of `*`, then we are just delaying the pain point to whenever `StarIsKind` ends up being not on by default.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">OTOH, if we don't have a standard short-hand way to refer to the kind of inhabited types, I imagine GHC will report some very ugly errors. For example:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal"> • Expecting one more argument to ‘Maybe’<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> Expected a type, but ‘Maybe’ has kind ‘Data.Kind.Type -> Data.Kind.Type’<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">And this is for a fairly simple kind error, they get much longer if, say, monad transformers are involved.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">What do others think?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">-Iavor<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">On Sat, Feb 3, 2018 at 8:24 PM Richard Eisenberg <<a href="mailto:rae@cs.brynmawr.edu" target="_blank">rae@cs.brynmawr.edu</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
<p class="MsoNormal"><br>
> On Feb 1, 2018, at 8:58 PM, Joachim Breitner <<a href="mailto:mail@joachim-breitner.de" target="_blank">mail@joachim-breitner.de</a>> wrote:<br>
><br>
> In particular in light of our use of “type” as a explicit namespace<br>
> token – so far in export and import lists and fixity declarations – I<br>
> worry that we will prevent ourselves from using more such explicit<br>
> namespace things in the future.<br>
<br>
This is a really good point. In private musings, I've often wondered about using the keyword `type` in expressions to denote a namespace change. More concretely, I'm worried about the Dreaded Namespace Problem (DNP): that is, a dependently typed language does
not want to have separate type-level and term-level namespaces. Of course, Haskell has this.<br>
<br>
The best solution I have so far to the DNP is to introduce a *new* namespace, distinct from the two namespaces we have so far. Let's call it the "default" namespace. When -XDependentTypes is on, the default namespace is in effect. Name lookup looks first in
the default namespace. If that fails the namespace consulted next depends on context: the "data" namespace in terms and the "type" namespace in type signatures. (This last bit needs to be specified more concretely, but you get the idea.) Or, perhaps, a failed
lookup in the default namespace will look up in both the type and data namespaces, erroring if a name appears in both.<br>
<br>
If a user wants to specify a namespace directly, they have a very easy way to do so: `type Foo` will look in the type namespace, `data Foo` will look in the data namespace, and `default Foo` will look in the default namespace. :) Because these keywords make
sense currently only at the beginning of a line, this Just Works. I also imagined these constructs could scope over a subexpression: `type (T S)`.<br>
<br>
All of this deserves a proper proposal and it's too early for that proposal. Nevertheless, I'm grateful that Joachim said something here, given that adding `type` as a spelling of `Type` would invalidate this approach. I also am swayed by the fact that `Type`
isn't fully primitive, and making a keyword mean something that's not primitive is a bit awkward. I thus retract this proposed alternative and will update the proposal accordingly.<br>
<br>
Richard<br>
_______________________________________________<br>
ghc-steering-committee mailing list<br>
<a href="mailto:ghc-steering-committee@haskell.org" target="_blank">ghc-steering-committee@haskell.org</a><br>
<a href="https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee" target="_blank">https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee</a><u></u><u></u></p>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div></div></div></blockquote></div></div></div>