Re: [Haskell-cafe] why can't you surround (+) in backticks and have it be infix?

2007-01-08 Thread David House

On 08/01/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Was anyone in that brainstorm thinking of Chung-chieh Shan's
-: and :-
(http://www.haskell.org/pipermail/haskell-cafe/2002-July/003215.html)


It's likely. I don't remember exactly where it came from.

--
-David House, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] why can't you surround (+) in backticks and have it be infix?

2007-01-08 Thread tpledger
David House wrote:
 :
 | You can fake this:
 |
 | (-!) = ($)
 | (!-) = flip ($)
 |
 | foo -! liftM2 (,) !- bar
 |
 | Not perfect, but it's interesting nonetheless.
 |
 | And yes, this was a product of some #haskell
 | brainstorming and algorithm tennis. :)

:-)

Was anyone in that brainstorm thinking of Chung-chieh Shan's
-: and :-
(http://www.haskell.org/pipermail/haskell-cafe/2002-July/003215.html)
or was the similarity just a really cool coincidence?

Regards,
Tom
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] why can't you surround (+) in backticks and have it be infix?

2007-01-08 Thread David House

On 08/01/07, Greg Buchholz <[EMAIL PROTECTED]> wrote:

...I've also thought it would be nice to be able to say things like...

(foo `liftM2 (,)` bar)


You can fake this:

(-!) = ($)
(!-) = flip ($)

foo -! liftM2 (,) !- bar

Not perfect, but it's interesting nonetheless.

And yes, this was a product of some #haskell brainstorming and
algorithm tennis. :)

--
-David House, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] why can't you surround (+) in backticks and have it be infix?

2007-01-08 Thread Greg Buchholz
tphyahoo wrote:
> 
> "Issues: In Haskell, any function or constructor can be enclosed in backticks
> and then used as an infix operator. "
> 
> from http://www-users.cs.york.ac.uk/~mfn/hacle/issues/node2.html
> 
> But this seems to be contradicted by...
> 
> from #haskell
> 
> -- 09:19 < tphyahoo> >  let func = (+) in 1 `func` 2
> -- 09:19 < lambdabot>  3
> -- 09:20 < tphyahoo> but ..
> -- 09:20 < tphyahoo> 1 `(+)` 2
> -- 09:20 < tphyahoo> > 1 `(+)` 2
> -- 09:20 < lambdabot>  Parse error
> 
> (+) is a function, is it not?
> 
> Where's the rub?

The thing inside the backticks has to be a syntatic name, not an
expression.  The grammar from the Haskell Report 
( http://www.haskell.org/onlinereport/syntax-iso.html )...

varid   ->(small {small | large | digit | ' }) 
conid   ->large {small | large | digit | ' }

varop   ->varsym  | `varid `   (variable operator) 
qvarop  ->qvarsym | `qvarid `  (qualified variable operator) 
conop   ->consym  | `conid `   (constructor operator) 
qconop  ->gconsym | `qconid `  (qualified constructor operator)

...I've also thought it would be nice to be able to say things like...

(foo `liftM2 (,)` bar)


Greg Buchholz

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] why can't you surround (+) in backticks and have it be infix?

2007-01-08 Thread tphyahoo

"Issues: In Haskell, any function or constructor can be enclosed in backticks
and then used as an infix operator. "

from http://www-users.cs.york.ac.uk/~mfn/hacle/issues/node2.html

But this seems to be contradicted by...

from #haskell

-- 09:19 < tphyahoo> >  let func = (+) in 1 `func` 2
-- 09:19 < lambdabot>  3
-- 09:20 < tphyahoo> but ..
-- 09:20 < tphyahoo> 1 `(+)` 2
-- 09:20 < tphyahoo> > 1 `(+)` 2
-- 09:20 < lambdabot>  Parse error

(+) is a function, is it not?

Where's the rub?

thomas.
-- 
View this message in context: 
http://www.nabble.com/why-can%27t-you-surround-%28%2B%29-in-backticks-and-have-it-be-infix--tf2939834.html#a8219424
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe