liftM2 (/) sum length. Anyway, the closest you can get in Haskell is
something like this, using the infix expressions of Ken Shan and Dylan
Thurstonhttp://www.haskell.org/pipermail/haskell-cafe/2002-July/003215.html
Hmm.. that might be decent if you added rules to pretty-print them in
On 10/29/07, Tim Newsham [EMAIL PROTECTED] wrote:
I would love to have the ability to define binary operator modifiers.
For example:
f \overline{op} g = liftM2 op f g
f \overleftarrow{op} n = liftM2 op f (return n)
n \overrightarrow{op} g = liftM2 op (return n) f
liftM2 (/) sum length. Anyway, the closest you can get in Haskell is
something like this, using the infix expressions of Ken Shan and Dylan
Thurstonhttp://www.haskell.org/pipermail/haskell-cafe/2002-July/003215.html
:
[]
It works (?), but it's pretty ugly and hardly seems worth it,
I would love to have the ability to define binary operator modifiers.
For example:
f \overline{op} g = liftM2 op f g
f \overleftarrow{op} n = liftM2 op f (return n)
n \overrightarrow{op} g = liftM2 op (return n) f
\widehat{f} x = liftM f x
so that for example you could
On Oct 29, 2007, at 3:36 , Tim Newsham wrote:
or go through the trouble of defining a bunch of binops
f + g = liftM2 (+) f g
n + g = return n + g
f + n = f + return n
read' = liftM read
This looks a lot like Control.Applicative to me.
--
brandon s. allbery
Hello Tim,
Monday, October 29, 2007, 10:36:18 AM, you wrote:
or go through the trouble of defining a bunch of binops
Is there any way in Haskell to modify binops in this way and still
be able to use them infix?
Template Haskell looks like an perfect tool for implementing this
--
Best