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

Nils Schweinsberg mail at nils.cc
Thu Feb 19 21:58:53 UTC 2015


If so, I feel like this would break consistency with the current syntax
since e.g. all these definitions of `f` would be valid but have completely
different type/meaning (even though in "classical" Haskell they would be
identical):

  f x y = infix (+) 1 2 x y -- f :: Int -> Int -> Int
  f x   = infix (+) 1 2 x   -- f :: Int -> Int
  f     = infix (+) 1 2     -- f :: Int

I like the general idea to represent variable argument functions as infix
function applications, but I wouldn't like a purely syntactical solution
that adds no real new functionality and is biased towards non-function
values like strings, integeres, etc.

On Thu, Feb 19, 2015 at 7:11 PM, Christopher Done <chrisdone at gmail.com>
wrote:

> On 19 February 2015 at 18:53, Nils Schweinsberg <mail at nils.cc> wrote:
> > What would be the typing rules for this? What would be the types of
> > e.g. pointfree written function definitions (`f` in `let f = infix + 5
> > in f 2 + f 2 3 4`)?
>
> Purely syntactical, the translation I gave was literal: let f = infix
> + 5 is the same as let f = (5 +). But to avoid confusion it's also
> possible to disallow unary arguments and mandate at least two
> arguments.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150219/49b69f8a/attachment.html>


More information about the Haskell-Cafe mailing list