Prefix and postfix operators

Marcin 'Qrczak' Kowalczyk [email protected]
Tue, 9 Sep 2003 20:56:48 +0200


Dnia śro 27. sierpnia 2003 20:48, Eugene Nonko napisał:

> Are there any plans to extend Haskell parser to support prefix and
> postfix operators? It will be just great for domain-specific languages.
> It always kind of bothered me that unary minus is special.

Having only infix operators has the advantage that operators are never 
adjacent to other operators, so you don't need extra spaces just to 
separate them nor complicated lexical conventions which tell where 
multi-character operator sequences should be split. Especially as prefix 
and postfix operators look better without spaces.

In Haskell there are rare troubles because of - and ~ (lazy patterns).
! (strictness annotations) happens not to be used adjacent to operators.
I think there are no more unary operators, so it's almost safe; problematic 
cases with - and ~ are really rare.

-- 
   __("<         Marcin Kowalczyk
   \__/       [email protected]
    ^^     http://qrnik.knm.org.pl/~qrczak/