On Fri, 2006-09-08 at 10:53 -0400, Peter Tanski wrote:
> On Sep 8, 2006, at 6:58 AM, skaller wrote:
> ; constructors have type (* -> *)--
> >
> > Functions have type TYPE too, all types have type TYPE.
> >
> > Simple type functions, on the other hand, have type TYPE -> TYPE.
> > A variant constructor has type TYPE because it is just a function:
> >
> > union Person = | Me of int | You of int
> > Me: int -> Person
Actually .. the more I think about this, the more interesting
it gets.
My example is bad. 'Me' isn't a 'real' type constructor.
The tuple constructor * is a type constructor, but it's
a binary one. The dup function:
dup: int -> int * int = ?x -> x,x
has type
int -> int * int
and kind
TYPE
But the dup constructor:
forall t. pair: t -> t * t
is not the same kind. It is both a family of functions and
a single functor (constructor)
TYPE -> TYPE
So going back to 'Me' it is both a family of one function,
that function having type
int -> Person
and also a constructor:
UNIT -> TYPE
where UNIT is a subkind of TYPE. For 'subkind' read 'subcategory',
in particular the one point category with one arrow. This can
be extended to
TYPE -> TYPE
by the simple artifact of ignoring the domain. So actually,
you are right: a type constructor isn't a function:
a function is a single arrow in a category. A type constructor
is a functor: a mapping between categories.
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language