# Specifying Kinds of Types

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

*Mon, 11 Feb 2002 07:49:20 -0800*

OK, it's done. In GHC you can specify kinds in=20
data type decls
type synonym decls
class decls
explicit for-alls
For example
data T (x :: *->*) =3D MkT
type Composer c =3D forall (x :: * -> *) (y :: * -> *) (z :: * -> =
*).=20
(c y z) -> (c x y) -> (c x z);
And you can put kind signatures on arbitrary types, rather
like you can put type signatures on arbitrary expressions.
No kind polymorphism though!
All this is in the HEAD. You'll need to build from source to get it
until we make a release.
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
*