Newbie proposal: operator backquoting
Dusty
dusty-aquarius at narod.ru
Mon Jun 25 01:07:52 EDT 2007
I'm too sorry about that, but my post client does not compatible with Haskell: it replace all occurence of backquotes by ordinary quotes. Please, replace them back when look at my letter :((
Alexander Dakhov.
> Hello, dear list members!
> I'm just a Haskell newbie, but I want to make some proposal to Haskell'.
> There are some tickets in tracking system, that inspired by conflict between binary operators and other use of the same lexeme. At least I found 3 of that: "get rid of unary '-' operator" (http://hackage.haskell.org/trac/haskell-prime/ticket/50), "Eliminate . as an operator" (http://hackage.haskell.org/trac/haskell-prime/ticket/20) and "Replace the array indexing operator, '!'" (http://hackage.haskell.org/trac/haskell-prime/ticket/96).
> IMHO, all specified problems may be made less embarrassing - if not completly solved - if Haskell' have some way to solve lexical ambiguity in concrete position. As for those problems have similar lexical construct (binary operator) on one side - and different construct on other side: so this solution must take place over binary operators.
> I propose to use the same construct, that always used to convert function application to binary operator: backquoting. Any lexeme, bounded by backquotes, will be treated by grammar as binary operator; and no special grammatic case can be applied. So:
>('-'1) is operator section, \x -> x-1, while (-1) is negative number
>('-'y) is operator section, \x -> x-y, while (-y) is unary function application, negate y
>foo '-'1 has two arguments, (-) and 1, while foo -1 has one argument, -1
>F'.'g is composition of function and constructor, while F.g is qualified function name
>('!'x) is operator section, while !x is bang pattern (or strictness annotation).
> I think, this proposal does not require neither big changes in Haskell grammar, nor it ruins any existing code.
>
> Alexander Dakhov.
>_______________________________________________
>Haskell-prime mailing list
>Haskell-prime at haskell.org
>http://www.haskell.org/mailman/listinfo/haskell-prime
More information about the Haskell-prime
mailing list