language extension: default higher-order function insts

Fergus Henderson fjh at cs.mu.oz.au
Sat May 31 05:49:56 AEST 1997


Hi,

I've been thinking about the following slight extension of the Mercury
mode system to better support higher-order functions:

	If the user does not explicitly specify a higher-order inst
	for an argument whose type is a higher-order function type,
	the inst defaults to `func(in, in, ..., in) = out is det',
	i.e. all args input, return value output, and det.
	This applies recursively to the function's
	arguments and return value too.

I think this extension could make higher-order functional programming
a lot more convenient. 

It is also very easy to implement (less than 15 lines of code).

Comments?

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list