[mercury-users] discriminated union question
Peter Ross
peter.ross at miscrit.be
Thu Apr 12 07:18:48 AEST 2001
On Wed, Apr 11, 2001 at 04:52:57PM -0400, Terrence Brannon wrote:
> :- type pair(T1, T2)
> ---> T1 - T2.
>
> What is the "-" sign doing here? What does it mean? It doesn't mean
> subtraction does it?
>
The Mercury parser converts T1 - T2 to '-'(T1, T2) which is valid term.
In other words the infix operators are just syntactic sugar.
Later on the type checker will decide from context whether the term is
the function '-'(A,B) which subtracts two numbers or the constructor
'-'(A,B) for a data term.
Hope this helps,
Pete
--------------------------------------------------------------------------
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