[mercury-users] Type declaration for a higher order function without arguments?
Fergus Henderson
fjh at cs.mu.OZ.AU
Fri Aug 6 14:04:57 AEST 2004
On 06-Aug-2004, Peter Hawkins <peter at hawkins.emu.id.au> wrote:
> Hi...
>
> How does one declare a function type that doesn't take arguments?
>
> This is ok:
> :- type myfunc(T) = (impure func(int) = T).
>
> This is not:
> :- type myfunc(T) = (impure func = T).
>
> Nor is this:
> :- type myfunc(T) = (impure func() = T).
>
> What's the secret?
'func' is a prefix operator, so if you want to use it without
an operand, you need to enclose it in parentheses:
:- type myfunc(T) == (impure (func) = T).
--
Fergus Henderson | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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