[m-dev.] :- type (type).

Mark Brown mark at cs.mu.OZ.AU
Tue Jun 28 16:24:15 AEST 2005


On 27-Jun-2005, Mark Brown <mark at cs.mu.OZ.AU> wrote:
> So here's the main types I propose to (re)define.
> 
> :- type (type)
> 	--->	variable(tvar, kind)
> 			% A type variable.
> 
> 	;	defined(sym_name, list(type), kind)
> 			% A user defined type constructor.
> 
> 	;	builtin(builtin_type)
> 			% These are all known to have kind `star'.
> 
> 	% The above three functors should be kept as the first three, since
> 	% they will be the most commonly used and therefore we want them to
> 	% get the primary tags on an x86.  (I believe this is the right way
> 	% to achieve that.)
> 
> 	;	pred_type(list(type))
> 			% A type for higher-order pred values.  The kind is
> 			% always `star'.
> 
> 	;	func_type(list(type), (type))
> 			% A type for higher_order func values.  The second
> 			% argument is the result type.  The kind is always
> 			% `star'.

Another alternative, suggested by Zoltan, would be to merge the above two
functors into one:

	;	higher_order(list(type), maybe(type))
			% A type for higher order values.  If the second
			% argument is yes(T) then the values are functions
			% returning T, otherwise they are predicates.  The
			% kind is always `star'.

> 
> 	;	tuple(list(type), kind)
> 			% Tuple types.
> 
> 	;	apply_n(tvar, list(type), kind)
> 			% An apply/N expression.  `apply_n(T, [T1, ...], K)'
> 			% would be the representation of type `T(T1, ...)'
> 			% with kind K.  The list must be non-empty.
> 
> 	;	kinded((type), kind).
> 			% A type expression with an explicit kind annotation.
> 			% (This functor won't be added until later.)
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list