new keyword: infixlr?

Lennart Augustsson lennart at augustsson.net
Sun Sep 12 18:51:52 EDT 2010


I don't think a syntactic property (how operators are parsed) should
be mixed up with a semantic property (being associative).
At least not in Haskell.

On Fri, Sep 10, 2010 at 7:51 PM, S. Doaitse Swierstra <doaitse at cs.uu.nl> wrote:
>
> Currently Haskell has infix, infixl and infixr operators. I see a use for infixlr as well. This indicates that the implemtation may assume the operator to be associative, and thus has the freedom to "balance" an expression containing several operator occurrences.
>
> The reason that I bring up this is that in a new combinator I have added to my parser library (the <||> in Text.ParserCombinators.UU.Derived) internally uses cartesian products, which are being constructed and updated. If the compiler had the right to interpret  the expressions a <||> b <||>c <||> d  as e.g. (a <||> b) <||> (c <||> d) then the updating time for would go down from O(n) to O(log n).
>
> I admit it is probably a minor point, but given the increased use of "type level" programming, and the use of cartesian products to keep "lists of values of a different type", I can also see many good uses for this.
>
> Any comments?
>
> Doaitse
>
>
>
> _______________________________________________
> 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