[Haskell-cafe] Automatic fixity allocation for symbolic operators

Bulat Ziganshin bulat.ziganshin at gmail.com
Mon Oct 16 11:54:14 EDT 2006


Hello Nicolas,

Monday, October 16, 2006, 6:31:42 PM, you wrote:

> What if operator precedences were specified as a partial order instead
> of using numbers?

> precInherit <*> -> @*@
> precAll ?+? > ?*?

> Regarding precAll: I'm not a regular expressions/glob for semantics
> fan, but you get the idea.

> The idea is to define a partial order on operators and let undecided
> operator relationships remain undefined. Composition remains an open
> issue, but perhaps someone else will have a light bulb about that.

well, it is what typically done when you define expression parsers by
hand (for any language that had fixed precedences). smth like this:

expr1 ::= expr2 | expr1 + expr2 | expr1 - expr2
expr2 ::= expr3 | expr2 * expr3 | expr2 / expr3
expr3 ::= ...

but when you want to have user-defined operators, that will mean that
you need either to define precedences to all other operators
(including those from other libs), or sometimes user programs will not
compile because they used combination of operators with undefined
precedence

good for making good headache :)


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list