# Specifying Kinds of Types

**Simon Peyton-Jones
**
simonpj@microsoft.com

*Fri, 8 Feb 2002 04:59:17 -0800*

Yes. GHC already does this in interface files, and
it'd be rather easy to make it do so in source programs too.
It seems like the Right Thing to do. I'll do it.
(John suggests going to kind polymorphism, but that would
raise a bunch of new issues in GHC's impls so I won't do that.
Yet.)
Simon
|* -----Original Message-----
*|* From: Ashley Yakeley [mailto:ashley@semantic.org]=20
*|* Sent: 08 February 2002 11:26
*|* To: Haskell List
*|* Subject: Specifying Kinds of Types
*|*=20
*|*=20
*|* I'd like to be able to declare the kinds of new types and synonyms,=20
*|* because sometimes Haskell can't infer them. For instance:
*|*=20
*|* data CMap0 p q =3D MkCMap0;
*|*=20
*|* Without evidence, Haskell assumes that p and q have kind '*'=20
*|* (as per sec.=20
*|* 4.6), and therefore CMap0 has kind '* -> * -> *'. Actually, I=20
*|* wanted p=20
*|* and q to both have kind '* -> *', giving CMap0 kind '(* -> *)=20
*|* -> (* -> *)=20
*|* -> *'.
*|*=20
*|* Here's another example:
*|*=20
*|* type Composer c =3D forall x y z. (c y z) -> (c x y) -> (c x z);
*|*=20
*|* Haskell gives x, y and z all the kind '*'. But I wanted them=20
*|* to have kind=20
*|* '* -> *', giving c the kind '(* -> *) -> (* -> *) -> *' and=20
*|* Composer the=20
*|* kind '(* -> *) -> (* -> *) -> * -> *'.
*|*=20
*|* It's not currently possible to specify kinds, is it? Actually I think=20
*|* polymorphic kinds would be nice, but I can't say I=20
*|* desperately need them.=20
*|* I'd just like to be able to specify kinds somehow. For instance:
*|*=20
*|* data CMap0 (p ::: * -> *) (q ::: * -> *) =3D MkCMap0;
*|*=20
*|* ...or perhaps
*|*=20
*|* data ({* -> *} p,{* -> *} q) =3D> CMap0 p q =3D MkCMap0;
*|*=20
*|* ...or whatever.
*|*=20
*|*=20
*|* --=20
*|* Ashley Yakeley, Seattle WA
*|*=20
*|* _______________________________________________
*|* Haskell mailing list
*|* Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
*|*=20
*