prefix operators

John Meacham john at
Wed Jul 7 19:58:59 EDT 2010

It occurred to me the other day that Haskell (w/ bang patterns) now has
3 prefix operators, all of which are defined independently and follow
their own special rules for parsing. we have (-), (!) and (~). 

It would seem to me that we should somehow be able to unify the
mechanism behind parsing these, as in practice, it seems that prefix
operators are useful in haskell.

We have some similarities, - and ! are both infix and prefix operators,
~ is not. ! and ~ can only be in patterns as prefix, (-) can be in both
patterns and expressions.

But it seems like we may be able to come up with a common way of parsing
them all, prolog has had user defined infix, prefix, and postfix
operators (sharing the same name even) and is still able to parse things
properly so I don't think there will be a technical issue.

My first impulse is to treat application as just another binary operator
with a certain precedence and find appropriate precedences for !,~,- in
the new framework. 

note: I am not proposing user defined prefix operators, just musing
about whether we can unify the rules behind parsing the current three
prefix operators, perhaps folding them into the fixity resolution


John Meacham - ⑆⑆john⑈ -

More information about the Haskell-prime mailing list