+1 to Eric's argument here. I would prefer to leave these fixities out. Of course, defining Bool-specific instantiations with fixities is a fine idea.
Do we have any other good examples where we've got an operator that is considered associative where the result type isn't identical to the argument types? It's much more common to allow the types to vary when there's only one associativity that makes sense for the way an operator is intended to be used.
a -> a -> a
While it's true that focusing on Bool, (==) satisfies associativity in its truth table, the types don't work out so cleanly. Outside of Bool it starts to matter which associativity you pick.
(\x y z -> (x == y) == z) :: Eq a => a -> a -> Bool -> Bool
(\x y z -> x == (y == z)) :: Eq a => Bool -> a -> a -> Bool
Making == associative is just going to lead to harder to understand code and will require people to memorize which arbitrary choice about the associativity of the operation was selected by the mailing list in order to make sense of the types of code using multiple ==.
I see no gain here, and I'd prefer to leave == as is.
Best regards,
Eric Mertens
Hi,
infixr seeems right for an equivalence (==) since implication is usually
also right associative.
Implication "==>" corresponds to "<=" on Bool, which might be confusing.
Reverse implication (>=) should be left associative, then.
Cheers Christian
Post by Dannyu NDosWell, infixr is friendlier to parsers.
Looks good to me! Do you have an opinion about infixl vs infixr?
Libraries mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries <http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries>
_______________________________________________
Libraries mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries <http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries>
_______________________________________________
Libraries mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries <http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries>
_______________________________________________
Libraries mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries