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

htebalaka goodingm at gmail.com
Fri Feb 20 00:44:07 UTC 2015


You could always follow the lead of BangPatterns and reserve a character to
make the syntax less ambiguous if you're using a function or macro. I think
(`idiom f a b) would be much nicer than quasi quoters are currently (with
the parentheses optional if the 'idiom' is being called on all the arguments
to the end of line). I don't think there are any valid uses of back ticks
when the token isn't immediately followed by another back tick.

The only real issue is making sure they nest properly.


Nils Schweinsberg-2 wrote
> 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@

> >
> wrote:
> 
>> On 19 February 2015 at 18:53, Nils Schweinsberg <

> mail@

> > 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.
>>
> 
> _______________________________________________
> Haskell-Cafe mailing list

> Haskell-Cafe@

> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe





--
View this message in context: http://haskell.1045720.n5.nabble.com/Proposal-Infix-expression-keyword-XInfixExpressions-tp5765656p5765701.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.


More information about the Haskell-Cafe mailing list