Hi,
Below are two questions on commutative operations in Haskell.

infixl 5 `com`
com :: Int -> Int -> Int
x `com` y  = (x + y)
commutative com a b = (a `com` b) == (b`com`a)

-- 1 + 3 == 3 + 1
-- This gives true by virtue of the value of LHS and RHS being equal
after the plus operation

-- Question 1
-- commutative com 1 3
-- This also gives true. Is it because of commutative equation or
because of the plus operation?

-- Question 2
-- In Haskell can commutativity be specified as a property of infix
operations?

This message has been scanned for content and viruses by the DIT Information 
Services E-Mail Scanning Service, and is believed to be clean. http://www.dit.ie
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to