
John Meacham wrote:
On Wed, Apr 23, 2008 at 09:52:11AM -0700, Simon Marlow wrote:
The problem with this is that
f !x y
would associate differently in an expression than it does on the left hand side of an equation, where ! is the prefix bang-pattern operator. To make this consistent we'd have to make ! a prefix operator in expressions, or give it the same precedence as function application; both mean a new extension.
Hmm.. that is another possible solution to the ~ ! - thing, have ~ and ! be prefix operators in general. with ~ meaning 'negate' in expressions. then parsing is the same everywhere.
Do prefix operators bind more or less tightly than infix operators? Either way, one of the two expressions (~2^3) or (~y$z) will parse somewhat unintuitively. I would expect these to mean ~(2^3) and (~y) $ z respectively. Dan