a plea for PolyKinds

Hi all, I'd like to make a small plea for PolyKinds. * Haskell is more Haskelly with PolyKinds than without. That is, a key attribute of Haskell is its let-generalization. Yet, oddly, Haskell by default does not generalize its kinds. It should. Here is a motivating example:
data App f a = App (f a)
With PolyKinds, App gets the kind (k -> Type) -> k -> Type. Without PolyKinds, GHC has to use defaulting to get (Type -> Type) -> Type -> Type, which might not work at certain use sites. * PolyKinds is backward compatible, except in obscure cases when a PolyKinds module is imported by a NoPolyKinds module. * Supporting NoPolyKinds is difficult within GHC, and I've been waiting for the right time to propose removing support for it. PolyKinds is conceptually *simpler* than NoPolyKinds, as it doesn't require an awkward defaulting step. Vote for PolyKinds! Thanks, Richard

Hi, Am Donnerstag, den 03.12.2020, 16:40 +0000 schrieb Richard Eisenberg:
Vote for PolyKinds!
convinced. Cheers, Joachim -- Joachim Breitner mail@joachim-breitner.de http://www.joachim-breitner.de/

I would totally support that if PolyKinds was implemented without requiring
TypeInType, but with the current design for me this is a solid `no`.
On Thu, Dec 3, 2020 at 9:48 AM Joachim Breitner
Hi,
Am Donnerstag, den 03.12.2020, 16:40 +0000 schrieb Richard Eisenberg:
Vote for PolyKinds!
convinced.
Cheers, Joachim -- Joachim Breitner mail@joachim-breitner.de http://www.joachim-breitner.de/
_______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.org https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee

I would totally support that if PolyKinds was implemented without requiring TypeInType, but with the current design for me this is a solid `no`.
Maybe you can say why? Solid sounds… solid.
Simon
From: ghc-steering-committee
Vote for PolyKinds!
convinced. Cheers, Joachim -- Joachim Breitner mail@joachim-breitner.demailto:mail@joachim-breitner.de http://www.joachim-breitner.de/https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.joachim-breitner.de%2F&data=04%7C01%7Csimonpj%40microsoft.com%7Ca7e57ca1aaa04682c10e08d897b416c6%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C637426147016852738%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=5BRa1m9VmGYrpfPd%2BCU6kuR2mRMwnGHL56rKmYDevag%3D&reserved=0 _______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.orgmailto:ghc-steering-committee@haskell.org https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committeehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.haskell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-steering-committee&data=04%7C01%7Csimonpj%40microsoft.com%7Ca7e57ca1aaa04682c10e08d897b416c6%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C637426147016862731%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ajZ4O2lU0DtkM63hKuG6skeitXdkFtYZ6xiklAKzEms%3D&reserved=0

I find the distinction between types and kinds helps me understand programs
better.
On Thu, Dec 3, 2020 at 9:53 AM Simon Peyton Jones
I would totally support that if PolyKinds was implemented without requiring TypeInType, but with the current design for me this is a solid `no`.
Maybe you can say why? Solid sounds… solid.
Simon
*From:* ghc-steering-committee
*On Behalf Of *Iavor Diatchki *Sent:* 03 December 2020 17:51 *To:* Joachim Breitner *Cc:* ghc-steering-committee *Subject:* Re: [ghc-steering-committee] a plea for PolyKinds I would totally support that if PolyKinds was implemented without requiring TypeInType, but with the current design for me this is a solid `no`.
On Thu, Dec 3, 2020 at 9:48 AM Joachim Breitner
wrote: Hi,
Am Donnerstag, den 03.12.2020, 16:40 +0000 schrieb Richard Eisenberg:
Vote for PolyKinds!
convinced.
Cheers, Joachim -- Joachim Breitner mail@joachim-breitner.de http://www.joachim-breitner.de/ https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.joachim-breitner.de%2F&data=04%7C01%7Csimonpj%40microsoft.com%7Ca7e57ca1aaa04682c10e08d897b416c6%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C637426147016852738%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=5BRa1m9VmGYrpfPd%2BCU6kuR2mRMwnGHL56rKmYDevag%3D&reserved=0
_______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.org https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.haskell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-steering-committee&data=04%7C01%7Csimonpj%40microsoft.com%7Ca7e57ca1aaa04682c10e08d897b416c6%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C637426147016862731%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ajZ4O2lU0DtkM63hKuG6skeitXdkFtYZ6xiklAKzEms%3D&reserved=0

But PolyKinds does not require TypeInType, according to the docs [
https://downloads.haskell.org/ghc/latest/docs/html/users_guide/glasgow_exts....]
it is in fact the other way around: TypeInType implies PolyKinds. Of
course, the fact that kinds and types are unified may leak somehow, but I
have a hard time figuring out an example of such.
El jue, 3 dic 2020 a las 18:51, Iavor Diatchki (
I would totally support that if PolyKinds was implemented without requiring TypeInType, but with the current design for me this is a solid `no`.
On Thu, Dec 3, 2020 at 9:48 AM Joachim Breitner
wrote: Hi,
Am Donnerstag, den 03.12.2020, 16:40 +0000 schrieb Richard Eisenberg:
Vote for PolyKinds!
convinced.
Cheers, Joachim -- Joachim Breitner mail@joachim-breitner.de http://www.joachim-breitner.de/
_______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.org 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

Oh? Perhaps I am confused, if we can have PolyKinds without TypeInType,
I'd be happy to change my vote. My understanding was that basically
`TypeInType` got renamed to `PolyKinds` but I might be confused.
-Iavor
On Thu, Dec 3, 2020 at 11:50 AM Alejandro Serrano Mena
But PolyKinds does not require TypeInType, according to the docs [ https://downloads.haskell.org/ghc/latest/docs/html/users_guide/glasgow_exts....] it is in fact the other way around: TypeInType implies PolyKinds. Of course, the fact that kinds and types are unified may leak somehow, but I have a hard time figuring out an example of such.
El jue, 3 dic 2020 a las 18:51, Iavor Diatchki (
) escribió: I would totally support that if PolyKinds was implemented without requiring TypeInType, but with the current design for me this is a solid `no`.
On Thu, Dec 3, 2020 at 9:48 AM Joachim Breitner
wrote: Hi,
Am Donnerstag, den 03.12.2020, 16:40 +0000 schrieb Richard Eisenberg:
Vote for PolyKinds!
convinced.
Cheers, Joachim -- Joachim Breitner mail@joachim-breitner.de http://www.joachim-breitner.de/
_______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.org 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

The truth is that (Type :: Type) is true no matter what (though you'd need KindSignatures for GHC to accept that). The features that were previously -XTypeInType have been moved into -XPolyKinds (and a few in -XDataKinds), because there seemed to be very little reason to keep the two extensions separate. PolyKinds essentially allows two things: it allows users to write variables and other constructs (like `forall`) in kinds, and it allows GHC to do kind-generalization. But nothing about -XPolyKinds really changes the relationship between types and kinds. Richard
On Dec 3, 2020, at 2:53 PM, Iavor Diatchki
wrote: Oh? Perhaps I am confused, if we can have PolyKinds without TypeInType, I'd be happy to change my vote. My understanding was that basically `TypeInType` got renamed to `PolyKinds` but I might be confused.
-Iavor
On Thu, Dec 3, 2020 at 11:50 AM Alejandro Serrano Mena
mailto:trupill@gmail.com> wrote: But PolyKinds does not require TypeInType, according to the docs [https://downloads.haskell.org/ghc/latest/docs/html/users_guide/glasgow_exts.... https://downloads.haskell.org/ghc/latest/docs/html/users_guide/glasgow_exts....] it is in fact the other way around: TypeInType implies PolyKinds. Of course, the fact that kinds and types are unified may leak somehow, but I have a hard time figuring out an example of such. El jue, 3 dic 2020 a las 18:51, Iavor Diatchki (
mailto:iavor.diatchki@gmail.com>) escribió: I would totally support that if PolyKinds was implemented without requiring TypeInType, but with the current design for me this is a solid `no`. On Thu, Dec 3, 2020 at 9:48 AM Joachim Breitner
mailto:mail@joachim-breitner.de> wrote: Hi, Am Donnerstag, den 03.12.2020, 16:40 +0000 schrieb Richard Eisenberg:
Vote for PolyKinds!
convinced.
Cheers, Joachim -- Joachim Breitner mail@joachim-breitner.de mailto:mail@joachim-breitner.de http://www.joachim-breitner.de/ http://www.joachim-breitner.de/
_______________________________________________ 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 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 agree with Richard as well on this point. The error messages GHC
reports can be practically incomprehensible and even misleading when
PolyKinds is accidentally turned off in a module that imports and
attempts to use poly-kinded things. I could probably drum up an
example if people want (I've run into this problem several times, but
don't have one immediately on hand.)
If it were just switched on by default, I'd feel a lot better about
the extension, because I wouldn't have to worry that consumers of any
poly-kinded things I wrote had to be aware of these stumbling blocks.
Of course, if GHC could get better at suggesting that users should
turn PolyKinds on in the cases where it's an issue, that would also be
great, but I'm not quite sure how to approach that either.
- Cale
On Thu, 3 Dec 2020 at 12:48, Joachim Breitner
Hi,
Am Donnerstag, den 03.12.2020, 16:40 +0000 schrieb Richard Eisenberg:
Vote for PolyKinds!
convinced.
Cheers, Joachim -- Joachim Breitner mail@joachim-breitner.de http://www.joachim-breitner.de/
_______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.org https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee

On Thu, Dec 3, 2020 at 5:40 PM Richard Eisenberg
data App f a = App (f a)
With PolyKinds, App gets the kind (k -> Type) -> k -> Type. Without PolyKinds, GHC has to use defaulting to get (Type -> Type) -> Type -> Type, which might not work at certain use sites.
You know how I dislike this automatic kind generalisation. This is not going to win me over :-p . I still think that the polymorphism inference of PolyKind was a mistake. That being said, it's something that we have committed to. It's going to be quite hard to change any time soon.
* Supporting NoPolyKinds is difficult within GHC, and I've been waiting for the right time to propose removing support for it. PolyKinds is conceptually *simpler* than NoPolyKinds, as it doesn't require an awkward defaulting step.
On the other hand, I'd say that this is a rather strong argument. Who else wants to remove `NoPolyKinds`? Simon PJ, what do you think? Is it even possible while still supporting Haskell2010?

On Dec 4, 2020, at 3:18 AM, Spiwack, Arnaud
wrote: Is it even possible while still supporting Haskell2010?
My hunch is "yes". I can imagine trouble with PolyKinds, but each example requires one of NoPolyKinds (in another module), ScopedTypeVariables, or KindSignatures. And each case of trouble is obscure. Richard
participants (7)
-
Alejandro Serrano Mena
-
Cale Gibbard
-
Iavor Diatchki
-
Joachim Breitner
-
Richard Eisenberg
-
Simon Peyton Jones
-
Spiwack, Arnaud