I'm trying to wrap my head around this blog post about the ConstraintKinds
extension.
There was a post in the comment section which I totally did not understand. Here it is:
Adam M says: 14 September 2011 19:53 UTC
Wow, this sounds great. Is it scheduled to be part of the official
GHC 7.4
? Also, does this mean that you've introduced a third production in the in System FC2 grammar for Kinds? Currently it has*
andk~>k
as the only alternatives wherek1~>k2
is (basically) the kind of(forall a::k1 . (t::k2))
. It sounds like this would addk1==>k2
which is the kind of(a::k1 => (t::k2))
. Or are the two kinds actually the same?
Could someone, please analyze this step-by-step or at least provide some links which would help me wrap my head around this myself. Some key moments I should pinpoint:
- What is a "System FC2 grammar for Kinds"? (Probably the main and the most general one, whose answer would embed the two other ones.)
- I tried explaining why "
k1~>k2
is (basically) the kind of(forall a::k1 . (t::k2))
"? As far as I understand,~>
is some special notation for->
in kinds, as*
andk1 -> k2
the only inhabitants of the standard Haskell's kind system (fits their description: "Currently it has*
andk~>k
as the only alternatives"). Thus, the(forall a::k1 . (t::k2))
formula means that if we take an inhabited typek1
, it can be mapped onto anotherk2
iff it is inhabited (due to Curry-Howard working for kinds the same way it works for types). Is that right? (P.S.: I see how this intuition fails if I do not understand the notion of inhabitance for kinds; do kinds correspond toTrueprovable formulae (see comments) when they have an inhabited type as an inhabitant or an arbitrary type? The intuition fails in the second case.) - What does the
=>
mean in the formula fork1==>k2
, namely(a::k1 => (t::k2))
?
The response this comment got:
Max says: 14 September 2011 21:11 UTC
Adam: it's not that complicated! It just adds the base kind
Constraint
to the grammar of kinds. This is a kind of types inhabited by values, just like the existing kinds*
and#
.
So the author claims that Adam M overcomplicated the extension. Their response is quite easy to understand. Anyway, even if Adam M's comment is not true, I think it is totally worth attention as it introduced some unfamiliar concepts to me.