I only know the answer to 3.
When a type is compiled with -XPolyKinds
and no restriction on the kind of a type variable, GHC prints the type very badly. After the type name, it prints a list of kinds of all the polymorphic type variables, then the type variables. So the k
showing up in the type signature means that the type variable s
can be of any kind. (Due to the way it's used, b
must have kind *
, so it's not kind-polymorphic, so its kind isn't listed.)
As an example of how ridiculous this can get, here's an example from the haddock docs of a library I'm working on now..
(SingI Nat a, SingI Nat b, SingI Nat c, SingI Nat d, SingI Nat e) => StaticSize ((,,,,) Nat Nat Nat Nat Nat) ((,,,,) Nat Nat Nat Nat Nat a b c d e)
It's using a promoted 5-tuple, too. That just makes it extra-silly, since that means the tuple shows up in both the kind and the type.