[Haskell-cafe] Function application layout

Jonas Almström Duregård jonas.duregard at chalmers.se
Wed May 25 11:00:08 CEST 2011


Hi,

Would it be possible to allow this in Haskell (where <applied to> is some
new operator or keyword):

f <applied to> {x a;y b;z c}

As an equivalent to:

f (x a) (y b) (z c)

Of course my intention is that the new keyword should initiate layout syntax
so we can write this:

f <applied to>
  x a
  y b
  z c

In addition to the case where you have a big function application, this is
useful for defining trees:

Branch <applied to>
 Branch <applied to>
   Leaf
   Leaf
 Leaf

Has something like this been suggested before? Are there any disadvantages
other than a new keyword and some potential confusion for readers?
Any suggestions for a good keyword? I suppose some variant of $ makes sense,
a textual keyword like "with" would be nice but probably break a lot of
code.

Regards,
Jonas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110525/f4961b6b/attachment.htm>


More information about the Haskell-Cafe mailing list