[m-dev.] language extension: default higher-order function insts

Thomas Charles CONWAY conway at cs.mu.oz.au
Mon Jun 2 09:18:21 AEST 1997


Fergus wrote:
> 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?

I think this is quite a good idea. It is a shame that there is no
equivalent default inst for predicate terms.

-- 
ZZ:wq!
^X^C
Thomas Conway               				      conway at cs.mu.oz.au
AD DEUM ET VINUM	  			      Every sword has two edges.



More information about the developers mailing list