[mercury-users] Why not using constructors as HO functions ?

Holger Krug hkrug at rationalizer.com
Thu Jul 26 18:26:09 AEST 2001


On Thu, Jul 26, 2001 at 05:51:04PM +1000, Fergus Henderson wrote:
> On 26-Jul-2001, Holger Krug <hkrug at rationalizer.com> wrote:
> > I tried to use a constructor as a function in a place where a higher
> > order argument is expected, but this seems to be impossible.
> 
> Constructors are equivalent to multi-moded functions.  Currently Mercury
> doesn't let you use multi-moded functions where a higher-order argument is
> expected; you need to use an explicit lambda expression to specify the mode.

OK. That's clear. Maybe one could change the error message accordingly.
Currently the claim is:

demo.m:089: In clause for function `demo:lexemes/0':
demo.m:089:   in function result term of clause head:
demo.m:089:   in argument 1 of functor `./2':
demo.m:089:   in argument 1 of functor `lexeme/2':
demo.m:089:   in argument 1 of functor `t/1':
demo.m:089:   error: wrong number of arguments (0; should be 1)
demo.m:089:   in use of constructor `comment'.

It seems to be better to change the last two lines into something like:

demo.m:089:   error: multi-moded function `comment' not allowed
demo.m:089:   where a higher-order argument is expected.

-- 
Holger Krug
hkrug at rationalizer.com
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list