why can't you surround (+) in backticks and have it be infix?

"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-ha... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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 | ' })<reservedid> 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

On 08/01/07, Greg Buchholz
...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, dmhouse@gmail.com
participants (3)
-
David House
-
Greg Buchholz
-
tphyahoo