# A type constructor is better called a "type descriptor"

Submitted by metaperl on Sat, 04/22/2006 - 9:07am.

::

A type "constructor" just describes what a data constructor builds. It doesn't construct anything and shouldn't be called a constructor.

- metaperl's blog
- Login to post comments

It constructs a type, exactly like a data constructor constructs a piece of data.

A type constructor does create a new type: it's a function from the types to the types.

For example, the kind of Either is (* -> * -> *), where * is the kind of simple types. Wwhen applied to two type paramaters, as is Either String Char, you get a type (a thing with kind *).

Actually, the definition of types is very similar to the definition of functions and values in haskell, except you don't have pattern matching. This is due to not having an advanced kind system. Also, you need to add a constructor when using newtype. Here are some examples:

data Nil -- kind *

newtype Apply a b = Applied (a b) -- kind (* -> *) -> * -> *

newtype Y t = Y (t (Y t)) -- kind (* -> *) -> *