[mercury-users] Higher order / currying functors

Michael Day mikeday at bigpond.net.au
Fri Aug 31 11:47:09 AEST 2001


Hi,

I tried using a functor where a function was expected, like this:

:- type foo ---> f(int).

:- pred do_stuff(func(int) = foo, ...).

do_stuff(f, ...)

passing f as a function that can be used to construct foos. I wasn't
really expecting it to work, as you can't take the address of multimoded
functions/predicates yet and functors are multimoded, right? But it didn't
not work for that reason, it just complained that f should have more
arguments.

Will it ever be possible to treat functors as functions - ie. is this
something that just hasn't been done yet or is it not going to happen due
to the way Mercury handles types and modes?

Michael

--------------------------------------------------------------------------
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