<div dir="ltr">Hello,<div><br></div><div>I'd be happy to make changes to the text of the proposal, but I would like to understand the underlying concerns so that I can address them appropriately. At the moment, I am pretty sure that I am missing something, as might be evident from my comments below. Either way, my comments below are intended to shed some light on my thinking, and emphasize the parts of Richard's comments I don't understand.</div><div><br></div><div><div class="gmail_quote"></div></div><div dir="ltr"><div><div class="gmail_quote"><div dir="ltr">On Wed, Aug 15, 2018 at 6:10 AM Richard Eisenberg <<a href="mailto:rae@cs.brynmawr.edu" target="_blank">rae@cs.brynmawr.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
- Types and kinds are simply the same now. There really is no difference. So the first sentence of this proposal, "This proposal introduces a language construct for defining kinds without having to promote types." is, in my opinion, quite misleading.</blockquote><div> </div><div>The proposal uses the same terminology that is used in GHC's manual, and also by the majority of the Haskell community. For example, Section 10.1 of the manual is about "Datatype Promotion", and the summary is "Allow promotion of data types to kind level.". Section 10.10.2 says "With DataKinds, GHC automatically promotes every datatype to be a kind and its (value) constructors to be type constructors.". This proposal introduces a language construct that allows us to declare non-empty kinds without having to promote a datatype in the sense of 10.1. I am talking about the language specification, not the actual implementation, which we can discuss once we agree we'd like to have this new feature.</div></div></div></div><div dir="ltr"><div><div class="gmail_quote"><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> All `data` declarations introduce kinds (because they introduce types, and types = kinds). And data constructors aren't really promoted either -- they can simply be used in types.<br></blockquote><div><br></div></div></div></div><div dir="ltr"><div><div class="gmail_quote"><div>Of course this is technically correct, but without data type promotion these are empty kinds that are a side-effect of mixing up types and kinds. I say empty "kinds" rather than empty "types" to emphasize the fact that I am referring to the kinding relation, not the typing one.</div></div></div></div><div dir="ltr"><div><div class="gmail_quote"><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- The proposal talks about referring to types in export lists. But we can already do this, via the normal syntax for listing data constructors with type constructors. So I'm not sure what that point of motivation really means.<br></blockquote><div><br></div></div></div></div><div dir="ltr"><div><div class="gmail_quote"><div>Here is a datatype declaration:</div><div><br></div><div>data T = A | B</div><div><br></div><div>In current GHC how would you export the type `A` of kind `T` without exporting the value `A` of type `T`?</div><div><br></div><div>Here is my attempt:</div><div><br></div><div><div>{-# Language DataKinds, ExplicitNamespaces #-}</div><div> </div><div>module M (type A) where</div><div><br></div><div>data T = A | B</div></div><div><br></div><div>This results in:</div><div><div><br></div><div>error: Not in scope: type constructor or class ‘A’</div><div> |</div><div>3 | module M (type A) where</div><div> | ^^^^^^</div></div></div></div></div><div dir="ltr"><div><div class="gmail_quote"><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- The "normal types win" is true, but it's all about namespace lookup. In a type, when GHC sees a capitalized identifier, it looks in the type namespace for that identifier. If the identifier is bound in the type namespace, that identifier is found. If not, GHC looks in the data-level namespace. According to this algorithm, "normal types win", indeed. But the "normal"cy of the type is that it lives in the type namespace, not because it isn't promoted.<br></blockquote><div><br></div></div></div></div><div dir="ltr"><div><div class="gmail_quote"><div>I think that with this proposal we have a much easier way to explain how things work, without having to refer to the algorithm used by GHC's renamer:</div><div><br></div><div>data T = A | B -- T is a type, and A and B are values of this type</div><div>type data S = X | Y -- S is a kind, and X and Y are types of this kind</div><div><br></div><div>Simple.</div></div></div></div><div dir="ltr"><div><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- If something introduced with `type data` can be used without -XDataKinds, then what does -XDataKinds really mean? It would seem to enable solely the extra data-level namespace check. That's fine with me, but we should document it that way. Alternatively, -XDataKinds could mean that some types have kinds that don't end in Type or Constraint, in which case it would need to be enabled to use a `type data` data constructor.<br></blockquote><div><br></div></div></div></div><div dir="ltr"><div><div class="gmail_quote"><div>This proposal is orthogonal to `DataKinds` and does not change anything about how it works. </div><div><br></div><div>Personally, if I had `TypeData`, I think I would very rarely use `DataKinds`, except for type-level nats and symbols, which should probably get a separate extension anyway. The reason is that I rarely need the same constructors at the value and the type level without any link between the two.</div></div></div></div><div dir="ltr"><div><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- The RHS of a `type data` does not introduce type constructors. A type constructor constructs a type -- that is, if T is a type constructor, then T applied to appropriate arguments has kind Type (or Constraint). But the data constructors of `type data` really are data constructors. It just so happens that their names live only in the type-level namespace. If we want, we can call these "type-level data constructors", but I think "type constructors" is misleading.<br></blockquote><div><br></div></div></div></div><div dir="ltr"><div><div class="gmail_quote"><div>I am sorry but I don't understand this at all---it is going contrary to the terminology used by the Haskell community for decades. I really don't see why we need to invent new terms, and arbitrarily limit the term "type-constructor" to only types of kind `Type` or `Constraint`, especially if we are willing to refer to all "kinds" as "types". The notion of classifying types by kinds and having a rich kind language is completely orthogonal to dependent types, and I think the current terminology works just fine.</div><div><br></div><div>If I am reading Richard's comments correctly (and I apologize if I am misunderstanding) his main concern is about terminology, based on his vision and plans about Dependent Haskell. I am supportive of work in this area, but I don't think that this proposal is the right place to start changing the terminology. I would suggest that we stick with the established language, which is widely used by the community, GHC's manual, and GHC's source code. Once there is a design document for Dependent Haskell, we could discuss that and settle on appropriate terminology.</div><div><br></div><div>-Iavor</div></div></div></div><div dir="ltr"><div><div class="gmail_quote"><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks,<br>
Richard<br>
<br>
> On Aug 14, 2018, at 8:31 PM, Eric Seidel <<a href="mailto:eric@seidel.io" target="_blank">eric@seidel.io</a>> wrote:<br>
> <br>
> Hi everyone!<br>
> <br>
> This proposal would allow the declaration of new kinds and type constructors, without the associated data constructors that would have been generated by -XDataKinds.<br>
> <br>
> <a href="https://github.com/yav/ghc-proposals/blob/data-kind-only/proposals/0000-type-data.rst" rel="noreferrer" target="_blank">https://github.com/yav/ghc-proposals/blob/data-kind-only/proposals/0000-type-data.rst</a><br>
> <br>
> It introduces a new language extension, -XTypeData, which allows declarations like the following:<br>
> <br>
> type data Universe = Character | Number | Boolean<br>
> <br>
> This introduces a new kind, Universe, with three associated type constructors<br>
> <br>
> Character :: Universe<br>
> Number :: Universe<br>
> Boolean :: Universe<br>
> <br>
> Notably, no data constructors are introduced.<br>
> <br>
> The proposal aims to solve several usability issues with -XDataKinds:<br>
> <br>
> 1. We often don't want the data constructors, which simply pollute the value namespace.<br>
> 2. We cannot easily control the export behavior of promoted types (instead we resort to tricks like the alias `type Character = 'Character`).<br>
> 3. The name resolution rules involving promoted types can be confusing.<br>
> <br>
> I find these issues (particularly #2) compelling, and the community response seems to be mostly positive, so I recommend accepting the proposal. <br>
> <br>
> I'm not particularly fond of the proposed syntax (`type data` makes it sound like we're doing something with data constructors, which is precisely what we're NOT doing), but the proposal has already had a good bit of bikeshedding, and people seem mostly happy with the current syntax, so I think we should probably stick with `type data`.<br>
> <br>
> Eric<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" rel="noreferrer" target="_blank">https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee</a><br>
<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" rel="noreferrer" target="_blank">https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee</a><br>
</blockquote></div></div></div></div>