[Haskell-cafe] Proposal: Infix expression keyword: -XInfixExpressions

Phil Ruffwind rf at rufflewind.com
Thu Feb 19 19:30:17 UTC 2015

That's an interesting idea!  A few remarks:

 1. For consistency it's probably a good idea to either backtick non-operators
    such as:

        infix `mappend` x y z

    or parenthesize operators such as:

        infix (+) x y z

    I tend to prefer the latter because my eyes are very accustomed to reading
    `infix + x y z` as `(infix) + (x y z)`.

 2. I think it might be useful to have a multiline version:

        infix (+) in
          y w
          z * d

    which the lexer desugars to:

        infix (+) in { x ; y w ; z * d }

    and is semantically equivalent to:

        infix (+) x (y w) (z * d)

    This provides the additional benefit of not having to parenthesize
    non-atomic arguments, which can be a source of typos.

More information about the Haskell-Cafe mailing list