
1 Nov
2010
1 Nov
'10
10:33 a.m.
Yes, that would prevent the shadowing. But now you are ignoring the
argument op1. Choosing a name that is more different from 'op' might
be helpful. You can even invent your own operator as an argument to
your commutative function:
commutative (⊕) = \a b -> (a ⊕ b) == (b ⊕ a)
On Mon, Nov 1, 2010 at 11:15 AM, Patrick Browne
Does the following avoid the shadowing?
infixl 5 `op` op :: Int -> Int -> Int x `op` y = (x + y) commutative op1 = \a b -> (a `op` b) == (b `op` a)