[m-dev.] Precedence of (,), (<=) and (=>) (...again)

Ralph Becket rafe at cs.mu.OZ.AU
Wed Sep 22 18:33:31 AEST 2004

I've just been bitten for the nth time by the fact that (=>) binds more
strongly than conjunction.  A goal like this will lead to (fairly
unhelpful) compiler errors complaining about binding variables in a
negated context:

	all [X] (

The problem arises because this is parsed as

	all [X] (
		( p(X) => q(X) ),

I recall asking that we change the priority of (=>) and (<=) to 1010
(i.e. *above* (,) which has priority 1000) years ago and nobody was

Another point in this proposal's favour is that multiple type class
constraints would no longer have to appear in parentheses.  That is, at
present we have to write

	:- pred p(T) <= (foo(T), bar(T)).

whereas with the changed precedence this would become

	:- pred p(T) <= foo(T), bar(T).

Any takers?
-- Ralph
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au

More information about the developers mailing list